aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/queries/goctl
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2023-06-12 09:54:30 -0600
committerChristian Clason <c.clason@uni-graz.at>2025-05-12 18:43:40 +0200
commit692b051b09935653befdb8f7ba8afdb640adf17b (patch)
tree167162b6b129ae04f68c5735078521a72917c742 /runtime/queries/goctl
parentfeat(c-family): inherit injections (diff)
downloadnvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.gz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.bz2
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.lz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.xz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.zst
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.zip
feat!: drop modules, general refactor and cleanup
Diffstat (limited to 'runtime/queries/goctl')
-rw-r--r--runtime/queries/goctl/folds.scm11
-rw-r--r--runtime/queries/goctl/highlights.scm79
-rw-r--r--runtime/queries/goctl/indents.scm15
-rw-r--r--runtime/queries/goctl/injections.scm3
4 files changed, 108 insertions, 0 deletions
diff --git a/runtime/queries/goctl/folds.scm b/runtime/queries/goctl/folds.scm
new file mode 100644
index 000000000..704928675
--- /dev/null
+++ b/runtime/queries/goctl/folds.scm
@@ -0,0 +1,11 @@
+[
+ (typeGroupSpec)
+ (typeSingleSpec)
+ (typeStruct)
+ (serviceSpec)
+ (serviceBody)
+ (importStatement)
+ (serviceServerSpec)
+ (infoStatement)
+ (structType)
+] @fold
diff --git a/runtime/queries/goctl/highlights.scm b/runtime/queries/goctl/highlights.scm
new file mode 100644
index 000000000..a4b809a1c
--- /dev/null
+++ b/runtime/queries/goctl/highlights.scm
@@ -0,0 +1,79 @@
+; Key Symbol
+"=" @operator
+
+[
+ "."
+ ","
+ ":"
+ ";"
+] @punctuation.delimiter
+
+[
+ "("
+ ")"
+ "{"
+ "}"
+ "["
+ "]"
+] @punctuation.bracket
+
+; Keywords
+[
+ "syntax"
+ "info"
+ "service"
+] @keyword
+
+"import" @keyword.import
+
+"returns" @keyword.return
+
+[
+ "type"
+ "struct"
+] @keyword.type
+
+[
+ "@doc"
+ "@handler"
+ "@server"
+] @attribute
+
+; Service
+(serviceName) @type
+
+; Httpmethod
+(HTTPMETHOD) @keyword.operator
+
+; Field
+(fieldType) @type.builtin
+
+(fieldName) @variable.member
+
+(anonymousField) @variable.member
+
+; Functions
+(handlerValue) @function.method
+
+; Strings
+(VALUE) @string
+
+(tag) @string.documentation
+
+(PATH) @string.special.path
+
+; Comments
+(comment) @comment @spell
+
+(key) @variable.member
+
+(identValue) @string
+
+(DURATION) @number
+
+(NUMBER) @number
+
+; Struct
+(structNameId) @type
+
+(body) @type
diff --git a/runtime/queries/goctl/indents.scm b/runtime/queries/goctl/indents.scm
new file mode 100644
index 000000000..ffa126905
--- /dev/null
+++ b/runtime/queries/goctl/indents.scm
@@ -0,0 +1,15 @@
+[
+ (importGroup)
+ (typeGroupSpec)
+ (structType)
+ (infoStatement)
+ (serviceServerSpec)
+ (serviceSpec)
+] @indent.begin
+
+[
+ ")"
+ "}"
+] @indent.branch @indent.end
+
+(comment) @indent.ignore
diff --git a/runtime/queries/goctl/injections.scm b/runtime/queries/goctl/injections.scm
new file mode 100644
index 000000000..a53abee57
--- /dev/null
+++ b/runtime/queries/goctl/injections.scm
@@ -0,0 +1,3 @@
+; Inject comment language for goctl
+((comment) @injection.content
+ (#set! injection.language "comment"))