Skip to content

Commit

Permalink
DBML Language support (helix-editor#8860)
Browse files Browse the repository at this point in the history
* DBML language support

* DBML language support, highlights.scm added

* DBML support

* Update runtime/queries/dbml/highlights.scm

Co-authored-by: Michael Davis <[email protected]>

* Update runtime/queries/dbml/highlights.scm

Co-authored-by: Michael Davis <[email protected]>

* Update runtime/queries/dbml/highlights.scm

Co-authored-by: Michael Davis <[email protected]>

* remove unnecessary block highlight

* remove unnecessary line

* remove index_block query

---------

Co-authored-by: Michael Davis <[email protected]>
  • Loading branch information
2 people authored and Schuyler Mortimer committed Jul 10, 2024
1 parent 0ebcfe1 commit a7b6244
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
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 @@ -2930,3 +2930,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

0 comments on commit a7b6244

Please sign in to comment.