DBML Tools — VSCode extensionLanguage support for DBML (Database Markup Language) files in Visual Studio Code. This extension is the editor frontend for
Features
Installation1. Install the
|
| Setting | Default | What it does |
|---|---|---|
dbml.path |
"" |
Absolute path to the dbml-tools binary. Leave empty to use the binary on $PATH. |
dbml.trace.server |
off |
LSP protocol tracing: off, messages, or verbose. Output goes to the DBML channel. |
dbml.log.path |
"" |
If set, the server writes detailed logs to this file. Useful for filing bug reports. |
Binary resolution order: dbml.path → $PATH lookup → bundled
per-platform binary.
Commands
| Command | Default keybinding |
|---|---|
DBML: Restart language server |
— |
Run via Cmd/Ctrl+Shift+P.
Quick start
Create schema.dbml and start typing:
Project myapp {
database_type: 'PostgreSQL'
}
Table users as u {
id int [pk, increment]
email varchar(255) [not null, unique]
status order_status
}
Enum order_status {
pending
shipped
cancelled
}
Ref: orders.user_id > u.id
Try:
- Hover over
order_statuson thestatuscolumn — you'll see the enum's values. - F12 on
u.idin theRefline — you'll jump to theuserstable. - F2 on
users— rename it everywhere in the file in one go. - Inside
[ … ], press Ctrl+Space — you'll seepk,unique,not null,default,note,ref, etc.
Troubleshooting
The most useful tool is the DBML output channel (View → Output →
DBML). Set dbml.trace.server to verbose to see every request and
response.
Common symptoms:
- "dbml-tools binary not found" — set
dbml.pathto an absolute path, or putdbml-toolson your$PATH. - Highlighting works but nothing else does — the grammar runs without
the server. If you see no diagnostics/hover/completions, the server
failed to start. Check the DBML output channel for errors, and confirm
the binary runs directly:
dbml-tools check schema.dbml. - Wrong positions / off-by-one — LSP positions are zero-based and
measured in UTF-16 code units. If positions look badly wrong with
non-ASCII identifiers, please file a bug with
dbml.trace.serverset toverboseand the captured trace attached.
For step-by-step development and debugging instructions, see DEBUG.md.
Development
git clone git@github.com:mevdschee/dbml-tools-vscode.git
cd dbml-tools-vscode
npm install
npm run build # one-shot
npm run watch # auto-rebuild
Then press F5 in VSCode to launch an Extension Development Host with
the extension loaded. See DEBUG.md for the full workflow,
including how to point the extension at a locally built dbml-tools
binary.
Run the grammar tests:
npm run test:grammar
The grammar test files live under test/grammar/ and use the
vscode-tmgrammar-test inline-assertion format.
Project layout
.
├── package.json Manifest + scripts
├── language-configuration.json Brackets, comments, auto-close
├── syntaxes/dbml.tmLanguage.json TextMate grammar
├── snippets/dbml.code-snippets Static snippets
├── src/extension.ts LSP client wiring
├── esbuild.config.js Bundler config
├── test/grammar/*.dbml Grammar tokenization tests
├── server-bin/ Per-platform `dbml-tools` binaries (CI fills)
└── DEBUG.md Local debugging guide
License
MIT.
See also
dbml-tools— the CLI & language server.- DBML specification — the language this extension supports.
- Holistics/dbml — the upstream DBML project.