From d6e9c6a88b45b21c452558e3045a6f95f43db4b7 Mon Sep 17 00:00:00 2001 From: Constantin Gahr Date: Sat, 28 Oct 2023 15:46:54 +0200 Subject: [PATCH 1/7] replace kdl tree-sitter --- languages.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages.toml b/languages.toml index 8b9b01e9cf31..b115501aa83f 100644 --- a/languages.toml +++ b/languages.toml @@ -2334,7 +2334,7 @@ injection-regex = "kdl" [[grammar]] name = "kdl" -source = { git = "https://github.com/Unoqwy/tree-sitter-kdl", rev = "e1cd292c6d15df6610484e1d4b5c987ecad52373" } +source = { git = "https://github.com/amaanq/tree-sitter-kdl", rev = "3ca569b9f9af43593c24f9e7a21f02f43a13bb88" } [[language]] name = "xml" From f20ecb67feeb9e298cc3c638f5c5a112a3376c74 Mon Sep 17 00:00:00 2001 From: Constantin Gahr Date: Sun, 29 Oct 2023 22:04:27 +0100 Subject: [PATCH 2/7] kdl: adopt highlights for new tree-sitter --- runtime/queries/kdl/highlights.scm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/runtime/queries/kdl/highlights.scm b/runtime/queries/kdl/highlights.scm index d83bde19ceed..48ddcc6a87ee 100644 --- a/runtime/queries/kdl/highlights.scm +++ b/runtime/queries/kdl/highlights.scm @@ -1,13 +1,11 @@ -(comment) @comment (single_line_comment) @comment +(multi_line_comment) @comment (node - name: (identifier) @function) + (identifier) @function) (prop (identifier) @attribute) (type) @type -(bare_identifier) @variable.other.member - (keyword) @keyword (string) @string From 95882d30b1714269f2977eb170449ead5d0a545d Mon Sep 17 00:00:00 2001 From: Constantin Gahr Date: Sun, 29 Oct 2023 22:05:53 +0100 Subject: [PATCH 3/7] kdl: add indent queries --- runtime/queries/kdl/indents.scm | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 runtime/queries/kdl/indents.scm diff --git a/runtime/queries/kdl/indents.scm b/runtime/queries/kdl/indents.scm new file mode 100644 index 000000000000..dd6e5c5fb84d --- /dev/null +++ b/runtime/queries/kdl/indents.scm @@ -0,0 +1,7 @@ +[ + (node_children) +] @indent + +[ + "}" +] @outdent From c40e0e924e3f0bc897b4c7c560552332b17a341b Mon Sep 17 00:00:00 2001 From: Constantin Gahr Date: Mon, 30 Oct 2023 11:03:22 +0100 Subject: [PATCH 4/7] kdl: add textobjects --- runtime/queries/kdl/textobjects.scm | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 runtime/queries/kdl/textobjects.scm diff --git a/runtime/queries/kdl/textobjects.scm b/runtime/queries/kdl/textobjects.scm new file mode 100644 index 000000000000..7f9a562cc770 --- /dev/null +++ b/runtime/queries/kdl/textobjects.scm @@ -0,0 +1,27 @@ +(type (_) @test.inside) @test.around + +(node + children: (node_children)? @class.inside) @class.around + +(node + children: (node_children)? @function.inside) @function.around + +(node (identifier) @function.movement) + +[ + (single_line_comment) + (multi_line_comment) +] @comment.inside + +[ + (single_line_comment)+ + (multi_line_comment)+ +] @comment.around + +[ + (prop) + (value) +] @parameter.inside + +(value (type) ? (_) @parameter.inside @parameter.movement . ) @parameter.around + From afcc622755b6d56f4a81c05c59afbab0b227b927 Mon Sep 17 00:00:00 2001 From: Constantin Gahr Date: Mon, 30 Oct 2023 11:03:36 +0100 Subject: [PATCH 5/7] kdl: improve syntax highlighting --- runtime/queries/kdl/highlights.scm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/runtime/queries/kdl/highlights.scm b/runtime/queries/kdl/highlights.scm index 48ddcc6a87ee..78e5acf4954b 100644 --- a/runtime/queries/kdl/highlights.scm +++ b/runtime/queries/kdl/highlights.scm @@ -2,9 +2,11 @@ (multi_line_comment) @comment (node - (identifier) @function) + (identifier) @variable) + (prop (identifier) @attribute) -(type) @type + +(type (_) @type) @punctuation.bracket (keyword) @keyword From 4ab65bcd71115fe391dd8cbb46e4e876042f34a4 Mon Sep 17 00:00:00 2001 From: Constantin Gahr Date: Mon, 30 Oct 2023 11:03:53 +0100 Subject: [PATCH 6/7] kdl: update lang-support --- book/src/generated/lang-support.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 48d805bc701a..6618dc2e3460 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -81,7 +81,7 @@ | jsx | ✓ | ✓ | ✓ | `typescript-language-server` | | julia | ✓ | ✓ | ✓ | `julia` | | just | ✓ | ✓ | ✓ | | -| kdl | ✓ | | | | +| kdl | ✓ | ✓ | ✓ | | | kotlin | ✓ | | | `kotlin-language-server` | | latex | ✓ | ✓ | | `texlab` | | lean | ✓ | | | `lean` | From 82b575f46ab511366f57b1a90ef3581419b932fc Mon Sep 17 00:00:00 2001 From: Constantin Gahr Date: Mon, 30 Oct 2023 11:21:24 +0100 Subject: [PATCH 7/7] kdl: make indents more concise --- runtime/queries/kdl/indents.scm | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/runtime/queries/kdl/indents.scm b/runtime/queries/kdl/indents.scm index dd6e5c5fb84d..bc2ffc15dadd 100644 --- a/runtime/queries/kdl/indents.scm +++ b/runtime/queries/kdl/indents.scm @@ -1,7 +1,3 @@ -[ - (node_children) -] @indent +(node_children) @indent -[ - "}" -] @outdent + "}" @outdent