From aad763de6ba7d5fbc93377d2d20cae7e374a466b Mon Sep 17 00:00:00 2001 From: Amaan Qureshi Date: Sat, 28 Jan 2023 07:59:56 -0500 Subject: feat: add kdl (#4227) * feat: add kdl * feat: comment queries * fix(kdl): comments properly highlighted now * feat(kdl): folds * chore: bump revision to feature-complete parser * fix: folds --- queries/kdl/folds.scm | 3 +++ queries/kdl/highlights.scm | 55 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 queries/kdl/folds.scm create mode 100644 queries/kdl/highlights.scm (limited to 'queries') diff --git a/queries/kdl/folds.scm b/queries/kdl/folds.scm new file mode 100644 index 000000000..04a2ba28e --- /dev/null +++ b/queries/kdl/folds.scm @@ -0,0 +1,3 @@ +; Folds + +(node_children) @fold diff --git a/queries/kdl/highlights.scm b/queries/kdl/highlights.scm new file mode 100644 index 000000000..0ef693d5a --- /dev/null +++ b/queries/kdl/highlights.scm @@ -0,0 +1,55 @@ +; Types + +(node (identifier) @type) + +(type) @type + +(annotation_type) @type.builtin + +; Properties + +(prop (identifier) @property) + +; Variables + +(identifier) @variable + +; Operators +[ + "=" + "+" + "-" +] @operator + +; Literals + +(string) @string + +(escape) @string.escape + +(number) @number + +(number (decimal) @float) +(number (exponent) @float) +(number (decimal) (exponent) @float) + +(boolean) @boolean + +; Misc + +"null" @constant.builtin + +["{" "}"] @punctuation.bracket + +["(" ")"] @punctuation.bracket + +; Comments + +[ + (single_line_comment) + (multi_line_comment) +] @comment + +(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 -- cgit v1.2.3-70-g09d2