From 7bfb02117864e9f87fc665bf4a18783ce7093830 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Thu, 14 Oct 2021 16:47:08 -0500 Subject: [PATCH 1/4] add submodule on tree-sitter/tree-sitter-tsq mark tsq submodule as shallow --- .gitmodules | 4 ++++ helix-syntax/languages/tree-sitter-tsq | 1 + 2 files changed, 5 insertions(+) create mode 160000 helix-syntax/languages/tree-sitter-tsq diff --git a/.gitmodules b/.gitmodules index 95b3670b6be0..2180049c0442 100644 --- a/.gitmodules +++ b/.gitmodules @@ -126,3 +126,7 @@ path = helix-syntax/languages/tree-sitter-vue url = https://github.com/ikatyang/tree-sitter-vue shallow = true +[submodule "helix-syntax/languages/tree-sitter-tsq"] + path = helix-syntax/languages/tree-sitter-tsq + url = https://github.com/tree-sitter/tree-sitter-tsq + shallow = true diff --git a/helix-syntax/languages/tree-sitter-tsq b/helix-syntax/languages/tree-sitter-tsq new file mode 160000 index 000000000000..b665659d3238 --- /dev/null +++ b/helix-syntax/languages/tree-sitter-tsq @@ -0,0 +1 @@ +Subproject commit b665659d3238e6036e22ed0e24935e60efb39415 From f67d0e9a6f65abf7039faa43d25773620c224910 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Fri, 15 Oct 2021 09:11:42 -0500 Subject: [PATCH 2/4] add tree-sitter-tsq to languages --- languages.toml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/languages.toml b/languages.toml index 7715425bf4bb..60b996c054fa 100644 --- a/languages.toml +++ b/languages.toml @@ -328,3 +328,11 @@ language-server = { command = "swipl", args = [ "-g", "use_module(library(lsp_server))", "-g", "lsp_server:main", "-t", "halt", "--", "stdio"] } + +[[language]] +name = "tsq" +scope = "source.tsq" +file-types = ["scm"] +roots = [] +comment-token = ";" +indent = { tab-width = 2, unit = " " } From 65f6512ab715353ca2f4e33ad9e6cdd92317e66d Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Fri, 15 Oct 2021 09:11:57 -0500 Subject: [PATCH 3/4] add highlight queries for tsq --- runtime/queries/tsq/highlights.scm | 46 ++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 runtime/queries/tsq/highlights.scm diff --git a/runtime/queries/tsq/highlights.scm b/runtime/queries/tsq/highlights.scm new file mode 100644 index 000000000000..9ba5699a8699 --- /dev/null +++ b/runtime/queries/tsq/highlights.scm @@ -0,0 +1,46 @@ +; mark the string passed #match? as a regex +(((predicate_name) @function + (capture) + (string) @string.regexp) + (#eq? @function "#match?")) + +; highlight inheritance comments +((query . (comment) @keyword.directive) + (#match? @keyword.directive "^;\ +inherits *:")) + +[ + "(" + ")" + "[" + "]" +] @punctuation.bracket + +":" @punctuation.delimiter + +[ + (one_or_more) + (zero_or_one) + (zero_or_more) +] @operator + +[ + (wildcard_node) + (anchor) +] @constant.builtin + +[ + (anonymous_leaf) + (string) +] @string + +(comment) @comment + +(field_name) @property + +(capture) @label + +(predicate_name) @function + +(escape_sequence) @escape + +(node_name) @variable From 226fee7c9ebb1f698a19ed09e2819ec3dd62156e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Sat, 16 Oct 2021 17:57:41 +0900 Subject: [PATCH 4/4] Update .gitmodules --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 2180049c0442..a8e6481ea19a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -129,4 +129,4 @@ [submodule "helix-syntax/languages/tree-sitter-tsq"] path = helix-syntax/languages/tree-sitter-tsq url = https://github.com/tree-sitter/tree-sitter-tsq - shallow = true + shallow = true