From 037fc57443eeb91db5bb8632f1d008166dce88cf Mon Sep 17 00:00:00 2001 From: ghashy <109857267+ghashy@users.noreply.github.com> Date: Sun, 19 Nov 2023 13:34:46 +0300 Subject: [PATCH 1/9] DBML language support --- languages.toml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/languages.toml b/languages.toml index 3dedf671513a..2a6cae066d4c 100644 --- a/languages.toml +++ b/languages.toml @@ -2928,3 +2928,16 @@ 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"] +roots = [] +comment-token = ";" +indent = { tab-width = 2, unit = " " } + +[[grammar]] +name = "dbml" +source = { git = "https://github.com/dynamotn/tree-sitter-dbml", rev = "2e2fa5640268c33c3d3f27f7e676f631a9c68fd9" } From 4b5133149cfa8306312d4fa742cca937eee959db Mon Sep 17 00:00:00 2001 From: ghashy Date: Sun, 19 Nov 2023 13:45:21 +0300 Subject: [PATCH 2/9] DBML language support, highlights.scm added --- runtime/queries/dbml/highlights.scm | 48 +++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 runtime/queries/dbml/highlights.scm diff --git a/runtime/queries/dbml/highlights.scm b/runtime/queries/dbml/highlights.scm new file mode 100644 index 000000000000..f6cf29912f18 --- /dev/null +++ b/runtime/queries/dbml/highlights.scm @@ -0,0 +1,48 @@ + +; comments highlighting +(comment) @comment + +; keyword highlighting +(keyword_def) @keyword +(keyword_enum) @keyword +(keyword_ref) @keyword + +; identify blocks and definitions +(block) @class +(definition) @function + +; for identifiers +(identifier) @variable +(type) @keyword + +; Highlight special types for database/data types +("Project" ) @type +("Table" ) @type +("TableGroup" ) @type +("database_type" ) @variable + +; Index related highlighting +(index_block) @class + +; string and number constants +("'''") @string.escape +(string) @string +(number) @constant + +; brackets +[ + "(" + ")" + "{" + "}" + "[" + "]" +] @punctuation.bracket + +; brackets +[ + ":" + "." + "," +] @punctuation.delimeter + From 57028d42d8a7fc709cb0f0c3a59283c7efa7c6ed Mon Sep 17 00:00:00 2001 From: ghashy Date: Sun, 19 Nov 2023 19:12:38 +0300 Subject: [PATCH 3/9] DBML support --- book/src/generated/lang-support.md | 1 + 1 file changed, 1 insertion(+) diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index a7d45a461240..2258c332ad59 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -24,6 +24,7 @@ | cue | ✓ | | | `cuelsp` | | d | ✓ | ✓ | ✓ | `serve-d` | | dart | ✓ | | ✓ | `dart` | +| dbml | ✓ | | | | | devicetree | ✓ | | | | | dhall | ✓ | ✓ | | `dhall-lsp-server` | | diff | ✓ | | | | From f0ba31aa9c4b87b2fd4d6ca22769872f0532f92c Mon Sep 17 00:00:00 2001 From: ghashy <109857267+ghashy@users.noreply.github.com> Date: Tue, 21 Nov 2023 21:59:13 +0300 Subject: [PATCH 4/9] Update runtime/queries/dbml/highlights.scm Co-authored-by: Michael Davis --- runtime/queries/dbml/highlights.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/queries/dbml/highlights.scm b/runtime/queries/dbml/highlights.scm index f6cf29912f18..01b7518eab22 100644 --- a/runtime/queries/dbml/highlights.scm +++ b/runtime/queries/dbml/highlights.scm @@ -27,7 +27,7 @@ ; string and number constants ("'''") @string.escape (string) @string -(number) @constant +(number) @constant.numeric ; brackets [ From e30c0cae042b907736f295a3c3b75af5128e0c37 Mon Sep 17 00:00:00 2001 From: ghashy <109857267+ghashy@users.noreply.github.com> Date: Tue, 21 Nov 2023 21:59:35 +0300 Subject: [PATCH 5/9] Update runtime/queries/dbml/highlights.scm Co-authored-by: Michael Davis --- runtime/queries/dbml/highlights.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/queries/dbml/highlights.scm b/runtime/queries/dbml/highlights.scm index 01b7518eab22..72b042fd0bbb 100644 --- a/runtime/queries/dbml/highlights.scm +++ b/runtime/queries/dbml/highlights.scm @@ -25,7 +25,7 @@ (index_block) @class ; string and number constants -("'''") @string.escape +("'''") @constant.character.escape (string) @string (number) @constant.numeric From 32fd16b0d7c88ee270787a8567ea2c613e70b3bd Mon Sep 17 00:00:00 2001 From: ghashy <109857267+ghashy@users.noreply.github.com> Date: Tue, 21 Nov 2023 21:59:57 +0300 Subject: [PATCH 6/9] Update runtime/queries/dbml/highlights.scm Co-authored-by: Michael Davis --- runtime/queries/dbml/highlights.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/queries/dbml/highlights.scm b/runtime/queries/dbml/highlights.scm index 72b042fd0bbb..90aa961945b3 100644 --- a/runtime/queries/dbml/highlights.scm +++ b/runtime/queries/dbml/highlights.scm @@ -44,5 +44,5 @@ ":" "." "," -] @punctuation.delimeter +] @punctuation.delimiter From 011ff0911de015a79c33ef2c83651e29fc53fba3 Mon Sep 17 00:00:00 2001 From: ghashy Date: Wed, 22 Nov 2023 00:03:16 +0300 Subject: [PATCH 7/9] remove unnecessary block highlight --- runtime/queries/dbml/highlights.scm | 1 - 1 file changed, 1 deletion(-) diff --git a/runtime/queries/dbml/highlights.scm b/runtime/queries/dbml/highlights.scm index 90aa961945b3..0e61d54e2ab5 100644 --- a/runtime/queries/dbml/highlights.scm +++ b/runtime/queries/dbml/highlights.scm @@ -8,7 +8,6 @@ (keyword_ref) @keyword ; identify blocks and definitions -(block) @class (definition) @function ; for identifiers From 0a4b10e84e8d4de589ea9ea1712c590e5ef289d2 Mon Sep 17 00:00:00 2001 From: ghashy Date: Wed, 22 Nov 2023 00:03:40 +0300 Subject: [PATCH 8/9] remove unnecessary line --- languages.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/languages.toml b/languages.toml index 2a6cae066d4c..bdda85132a2c 100644 --- a/languages.toml +++ b/languages.toml @@ -2934,7 +2934,6 @@ name = "dbml" scope = "source.dbml" injection-regex = "dbml" file-types = ["dbml"] -roots = [] comment-token = ";" indent = { tab-width = 2, unit = " " } From 8af20039f176f6b945b31a25529faa83247915af Mon Sep 17 00:00:00 2001 From: ghashy Date: Wed, 22 Nov 2023 17:51:29 +0300 Subject: [PATCH 9/9] remove index_block query --- runtime/queries/dbml/highlights.scm | 3 --- 1 file changed, 3 deletions(-) diff --git a/runtime/queries/dbml/highlights.scm b/runtime/queries/dbml/highlights.scm index 0e61d54e2ab5..accc65b4cfb5 100644 --- a/runtime/queries/dbml/highlights.scm +++ b/runtime/queries/dbml/highlights.scm @@ -20,9 +20,6 @@ ("TableGroup" ) @type ("database_type" ) @variable -; Index related highlighting -(index_block) @class - ; string and number constants ("'''") @constant.character.escape (string) @string