Skip to content

idoaflalo/dbml-formatter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DBML Formatter – The Best and Only DBML Formatter

Format your .dbml files with one click inside VS Code!
Automatically parse and format your Database Markup Language (DBML) files for clean, consistent, and readable schemas.

Visual Studio Marketplace Version
GitHub stars


Table of Contents


Features

  • Single-Command Formatting: Use the standard VS Code “Format Document” command to instantly reformat your DBML file.
  • DBML Validation: Leverages @dbml/core internally to parse your file, ensuring it’s syntactically correct.
  • No Reordering of References: Keeps your references exactly where you placed them, only adjusting spaces and indentation (according to the code you’ve integrated).
  • Indentation & Spacing: Removes excessive whitespace and enforces consistent spacing around tokens.
  • Smooth Integration: Automatically activates when you open a .dbml file in Visual Studio Code.

Installation

  1. Search for “DBML Formatter” in the Visual Studio Code Marketplace.
  2. Click “Install”.
  3. Reload your editor if prompted.

Or, install via CLI:

code --install-extension dbml-formatter.vsix

Usage

  1. Open any .dbml file in VS Code.
  2. Press Shift + Alt + F (Windows) or Shift + Option + F (macOS) or Ctrl + Shift + I (Linux) to format the document.
  3. Save your changes. Enjoy a clean DBML file!

You can also right-click in the editor and select:

Format Document

Or search the Command Palette (Ctrl+Shift+P or Cmd+Shift+P) for:

Format Document

Configuration

  • Error Handling: If the parser encounters invalid DBML, the formatter will notify you in VS Code with an error message.

Sample

Below is a quick before-and-after snippet:

Before:

Table users {
  _id          ObjectId      [primary key]
  firstName    string      [not null]
  lastName    string      [not null]
  ...
}

After:

Table users {
  _id ObjectId [primary key]
  firstName string [not null]
  lastName string [not null]
  ...
}

Contributing

  1. Fork this repo.
  2. Clone your fork locally.
  3. Install dependencies:
    npm install
  4. Make your changes (bug fixes, features, docs).
  5. Commit and push to your fork.
  6. Open a Pull Request describing your changes.

We welcome PRs for new features, bug fixes, or improvements in formatting logic!


License

This extension is provided under the MIT License. See the LICENSE file for details.


Happy Formatting!
DBML Formatter – Because your DBML deserves the best.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published