Unnamed repository; edit this file 'description' to name the repository.
feat(languages): specilize toml file-type for cross-rs config file (#14274)
Kristoffer Plagborg Bak Sørensen 6 months ago
parent b81ee02 · commit 74bb02f
-rw-r--r--book/src/generated/lang-support.md1
-rw-r--r--languages.toml12
-rw-r--r--runtime/queries/cross-config/highlights.scm1
-rw-r--r--runtime/queries/cross-config/injections.scm9
-rw-r--r--runtime/queries/cross-config/rainbows.scm1
-rw-r--r--runtime/queries/cross-config/textobjects.scm1
6 files changed, 24 insertions, 1 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index f963c25e..a6cf2833 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -31,6 +31,7 @@
| common-lisp | ✓ | | ✓ | | ✓ | `cl-lsp` |
| cpon | ✓ | | ✓ | | | |
| cpp | ✓ | ✓ | ✓ | ✓ | ✓ | `clangd` |
+| cross-config | ✓ | ✓ | | | ✓ | `taplo`, `tombi` |
| crystal | ✓ | ✓ | ✓ | ✓ | | `crystalline`, `ameba-ls` |
| css | ✓ | | ✓ | | ✓ | `vscode-css-language-server` |
| csv | ✓ | | | | | |
diff --git a/languages.toml b/languages.toml
index 42bd36fc..2379308c 100644
--- a/languages.toml
+++ b/languages.toml
@@ -4662,7 +4662,7 @@ scope = "source.kconfig"
name = "kconfig"
source = { git = "https://github.com/tree-sitter-grammars/tree-sitter-kconfig" , rev = "9ac99fe4c0c27a35dc6f757cef534c646e944881" }
-[[language]]
+[[language]]
name = "doxyfile"
scope = "source.doxyfile"
injection-regex = "[Dd]oxyfile"
@@ -4673,3 +4673,13 @@ indent = { tab-width = 4, unit = " " }
[[grammar]]
name = "doxyfile"
source = { git = "https://github.com/tingerrr/tree-sitter-doxyfile/", rev = "18e44c6da639632a4e42264c7193df34be915f34" }
+
+[[language]]
+name = "cross-config"
+scope = "source.cross-config"
+injection-regex = "cross(-config)"
+grammar = "toml"
+comment-token = "#"
+file-types = [{glob = "Cross.toml"}]
+language-servers = [ "taplo", "tombi" ]
+indent = { tab-width = 2, unit = " " }
diff --git a/runtime/queries/cross-config/highlights.scm b/runtime/queries/cross-config/highlights.scm
new file mode 100644
index 00000000..b55e36da
--- /dev/null
+++ b/runtime/queries/cross-config/highlights.scm
@@ -0,0 +1 @@
+; inherits: toml
diff --git a/runtime/queries/cross-config/injections.scm b/runtime/queries/cross-config/injections.scm
new file mode 100644
index 00000000..1262b7e8
--- /dev/null
+++ b/runtime/queries/cross-config/injections.scm
@@ -0,0 +1,9 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))
+
+; https://github.com/cross-rs/cross/blob/main/docs/config_file.md
+(pair
+ (bare_key) @_key (#eq? @_key "pre-build")
+ (array
+ (string) @injection.content)
+ (#set! injection.language "bash"))
diff --git a/runtime/queries/cross-config/rainbows.scm b/runtime/queries/cross-config/rainbows.scm
new file mode 100644
index 00000000..b55e36da
--- /dev/null
+++ b/runtime/queries/cross-config/rainbows.scm
@@ -0,0 +1 @@
+; inherits: toml
diff --git a/runtime/queries/cross-config/textobjects.scm b/runtime/queries/cross-config/textobjects.scm
new file mode 100644
index 00000000..b55e36da
--- /dev/null
+++ b/runtime/queries/cross-config/textobjects.scm
@@ -0,0 +1 @@
+; inherits: toml