aboutsummaryrefslogtreecommitdiffstats
path: root/queries/goctl
diff options
context:
space:
mode:
authorzhaown <51357674+chaozwn@users.noreply.github.com>2024-07-07 23:27:21 +0800
committerGitHub <noreply@github.com>2024-07-07 17:27:21 +0200
commitf9aa4f060ef73b487932696a84ed48b67eb1373e (patch)
tree1fd4107e229454c33eb0414a19ca05f380d34d76 /queries/goctl
parentfeat(ruby): highlights for special methods (#6735) (diff)
downloadnvim-treesitter-f9aa4f060ef73b487932696a84ed48b67eb1373e.tar
nvim-treesitter-f9aa4f060ef73b487932696a84ed48b67eb1373e.tar.gz
nvim-treesitter-f9aa4f060ef73b487932696a84ed48b67eb1373e.tar.bz2
nvim-treesitter-f9aa4f060ef73b487932696a84ed48b67eb1373e.tar.lz
nvim-treesitter-f9aa4f060ef73b487932696a84ed48b67eb1373e.tar.xz
nvim-treesitter-f9aa4f060ef73b487932696a84ed48b67eb1373e.tar.zst
nvim-treesitter-f9aa4f060ef73b487932696a84ed48b67eb1373e.zip
feat: add goctl parser and queries
Diffstat (limited to 'queries/goctl')
-rw-r--r--queries/goctl/folds.scm11
-rw-r--r--queries/goctl/highlights.scm79
-rw-r--r--queries/goctl/injections.scm3
3 files changed, 93 insertions, 0 deletions
diff --git a/queries/goctl/folds.scm b/queries/goctl/folds.scm
new file mode 100644
index 000000000..704928675
--- /dev/null
+++ b/queries/goctl/folds.scm
@@ -0,0 +1,11 @@
+[
+ (typeGroupSpec)
+ (typeSingleSpec)
+ (typeStruct)
+ (serviceSpec)
+ (serviceBody)
+ (importStatement)
+ (serviceServerSpec)
+ (infoStatement)
+ (structType)
+] @fold
diff --git a/queries/goctl/highlights.scm b/queries/goctl/highlights.scm
new file mode 100644
index 000000000..a4b809a1c
--- /dev/null
+++ b/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/queries/goctl/injections.scm b/queries/goctl/injections.scm
new file mode 100644
index 000000000..a53abee57
--- /dev/null
+++ b/queries/goctl/injections.scm
@@ -0,0 +1,3 @@
+; Inject comment language for goctl
+((comment) @injection.content
+ (#set! injection.language "comment"))