aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/queries/kdl
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/queries/kdl')
-rw-r--r--runtime/queries/kdl/folds.scm7
-rw-r--r--runtime/queries/kdl/highlights.scm71
-rw-r--r--runtime/queries/kdl/indents.scm14
-rw-r--r--runtime/queries/kdl/injections.scm5
-rw-r--r--runtime/queries/kdl/locals.scm16
5 files changed, 113 insertions, 0 deletions
diff --git a/runtime/queries/kdl/folds.scm b/runtime/queries/kdl/folds.scm
new file mode 100644
index 000000000..c96619b14
--- /dev/null
+++ b/runtime/queries/kdl/folds.scm
@@ -0,0 +1,7 @@
+; Folds
+[
+ (node)
+ (node_children)
+ (string)
+ (multi_line_comment)
+] @fold
diff --git a/runtime/queries/kdl/highlights.scm b/runtime/queries/kdl/highlights.scm
new file mode 100644
index 000000000..7d200c85e
--- /dev/null
+++ b/runtime/queries/kdl/highlights.scm
@@ -0,0 +1,71 @@
+; Types
+; Variables
+(identifier) @variable
+
+; Nodes
+(node
+ (identifier) @tag)
+
+; Type annotation
+(type
+ (identifier) @type)
+
+; Properties
+(prop
+ (identifier) @property)
+
+; Operators
+[
+ "="
+ "+"
+ "-"
+] @operator
+
+; Literals
+(string) @string
+
+(escape) @string.escape
+
+(number) @number
+
+(number
+ (decimal) @number.float)
+
+(number
+ (exponent) @number.float)
+
+(boolean) @boolean
+
+"null" @constant.builtin
+
+; Punctuation
+[
+ "{"
+ "}"
+] @punctuation.bracket
+
+[
+ "("
+ ")"
+] @punctuation.bracket
+
+";" @punctuation.delimiter
+
+; Comments
+[
+ (single_line_comment)
+ (multi_line_comment)
+] @comment @spell
+
+(node
+ (node_comment)
+ (#set! priority 105)) @comment
+
+(node
+ (node_field
+ (node_field_comment)
+ (#set! priority 105)) @comment)
+
+(node_children
+ (node_children_comment)
+ (#set! priority 105)) @comment
diff --git a/runtime/queries/kdl/indents.scm b/runtime/queries/kdl/indents.scm
new file mode 100644
index 000000000..6d16efd2d
--- /dev/null
+++ b/runtime/queries/kdl/indents.scm
@@ -0,0 +1,14 @@
+(node
+ (node_children) @indent.begin)
+
+"}" @indent.end
+
+[
+ "{"
+ "}"
+] @indent.branch
+
+[
+ "("
+ ")"
+] @indent.branch
diff --git a/runtime/queries/kdl/injections.scm b/runtime/queries/kdl/injections.scm
new file mode 100644
index 000000000..81d7734cb
--- /dev/null
+++ b/runtime/queries/kdl/injections.scm
@@ -0,0 +1,5 @@
+([
+ (single_line_comment)
+ (multi_line_comment)
+] @injection.content
+ (#set! injection.language "comment"))
diff --git a/runtime/queries/kdl/locals.scm b/runtime/queries/kdl/locals.scm
new file mode 100644
index 000000000..14b0af23e
--- /dev/null
+++ b/runtime/queries/kdl/locals.scm
@@ -0,0 +1,16 @@
+(document) @local.scope
+
+(node
+ (node_children) @local.scope)
+
+(node_children
+ (node) @local.scope)
+
+(identifier) @local.reference
+
+(node_field) @local.definition.field
+
+(node
+ (identifier) @local.definition.type)
+
+(type) @local.definition.type