aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatouš Dzivjak2022-09-08 14:04:18 +0000
committerGitHub2022-09-08 14:04:18 +0000
commit5ab85283e944b9b0409c70953c7655b9c5f84067 (patch)
treee87d49c1a51e866b5b607bfd2fff8e32ac0f184c
parent16ce036bdf3a7899d14d62bc46bbc9a8b5fa99e3 (diff)
feat(languages): jsonnet (#3714)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
-rw-r--r--book/src/generated/lang-support.md1
-rw-r--r--languages.toml12
-rw-r--r--runtime/queries/jsonnet/highlights.scm38
3 files changed, 51 insertions, 0 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index a66fae21..88c9df91 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -53,6 +53,7 @@
| javascript | ✓ | ✓ | ✓ | `typescript-language-server` |
| jsdoc | ✓ | | | |
| json | ✓ | | ✓ | `vscode-json-language-server` |
+| jsonnet | ✓ | | | |
| jsx | ✓ | ✓ | ✓ | `typescript-language-server` |
| julia | ✓ | | | `julia` |
| kotlin | ✓ | | | `kotlin-language-server` |
diff --git a/languages.toml b/languages.toml
index c7bc982d..12f02781 100644
--- a/languages.toml
+++ b/languages.toml
@@ -1726,3 +1726,15 @@ roots = []
[[grammar]]
name = "sml"
source = { git = "https://github.com/Giorbo/tree-sitter-sml", rev = "bd4055d5554614520d4a0706b34dc0c317c6b608" }
+
+[[language]]
+name = "jsonnet"
+scope = "source.jsonnet"
+file-types = ["libsonnet", "jsonnet"]
+roots = []
+comment-token = "//"
+indent = { tab-width = 2, unit = " " }
+
+[[grammar]]
+name = "jsonnet"
+source = { git = "https://github.com/sourcegraph/tree-sitter-jsonnet", rev = "0475a5017ad7dc84845d1d33187f2321abcb261d" }
diff --git a/runtime/queries/jsonnet/highlights.scm b/runtime/queries/jsonnet/highlights.scm
new file mode 100644
index 00000000..f54e7d5c
--- /dev/null
+++ b/runtime/queries/jsonnet/highlights.scm
@@ -0,0 +1,38 @@
+["if" "then" "else"] @keyword.control.conditional
+[
+ (local)
+ "function"
+] @keyword
+(comment) @comment
+
+(string) @string
+(number) @constant.numeric
+[
+ (true)
+ (false)
+] @constant.builtin.boolean
+
+(binaryop) @operator
+(unaryop) @operator
+
+(param identifier: (id) @variable.parameter)
+(bind function: (id) @function)
+(fieldname (id) @variable.other.member)
+[
+ "["
+ "]"
+ "{"
+ "}"
+] @punctuation.bracket
+"for" @keyword.control.repeat
+"in" @keyword.operator
+[(self) (dollar)] @variable.builtin
+"assert" @keyword
+(null) @constant.builtin
+[
+ ":"
+ "::"
+ ";"
+ "="
+] @punctuation.delimiter
+(id) @variable