Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DBML Language support #8860

Merged
merged 11 commits into from
Nov 22, 2023
1 change: 1 addition & 0 deletions book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
| cue | ✓ | | | `cuelsp` |
| d | ✓ | ✓ | ✓ | `serve-d` |
| dart | ✓ | | ✓ | `dart` |
| dbml | ✓ | | | |
| devicetree | ✓ | | | |
| dhall | ✓ | ✓ | | `dhall-lsp-server` |
| diff | ✓ | | | |
Expand Down
12 changes: 12 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2928,3 +2928,15 @@ language-servers = [ "templ" ]
[[grammar]]
name = "templ"
source = { git = "https://github.com/vrischmann/tree-sitter-templ", rev = "ea56ac0655243490a4929a988f4eaa91dfccc995" }

[[language]]
name = "dbml"
scope = "source.dbml"
injection-regex = "dbml"
file-types = ["dbml"]
comment-token = ";"
indent = { tab-width = 2, unit = " " }

[[grammar]]
name = "dbml"
source = { git = "https://github.com/dynamotn/tree-sitter-dbml", rev = "2e2fa5640268c33c3d3f27f7e676f631a9c68fd9" }
44 changes: 44 additions & 0 deletions runtime/queries/dbml/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

; comments highlighting
(comment) @comment

; keyword highlighting
(keyword_def) @keyword
(keyword_enum) @keyword
(keyword_ref) @keyword

; identify blocks and definitions
(definition) @function

; for identifiers
(identifier) @variable
(type) @keyword

; Highlight special types for database/data types
("Project" ) @type
("Table" ) @type
("TableGroup" ) @type
("database_type" ) @variable

; string and number constants
("'''") @constant.character.escape
(string) @string
(number) @constant.numeric

; brackets
[
"("
")"
"{"
"}"
"["
"]"
] @punctuation.bracket

; brackets
[
":"
"."
","
] @punctuation.delimiter

Loading