aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSora2022-10-21 22:32:29 +0000
committerGitHub2022-10-21 22:32:29 +0000
commit664064b3cca49479c3e893f4865e64cb587d2f61 (patch)
treed23f8b7f62097901b991d824f471771ef78a9637
parent79ef39ab3a41c32fcdcb660df6ee60aeb1eb80e6 (diff)
Add textobjects.scm for zig (#4409)
-rw-r--r--book/src/generated/lang-support.md2
-rw-r--r--runtime/queries/zig/textobjects.scm23
2 files changed, 24 insertions, 1 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index c6edc66d..caf5d525 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -126,4 +126,4 @@
| wgsl | ✓ | | | `wgsl_analyzer` |
| xit | ✓ | | | |
| yaml | ✓ | | ✓ | `yaml-language-server` |
-| zig | ✓ | | ✓ | `zls` |
+| zig | ✓ | ✓ | ✓ | `zls` |
diff --git a/runtime/queries/zig/textobjects.scm b/runtime/queries/zig/textobjects.scm
new file mode 100644
index 00000000..67528943
--- /dev/null
+++ b/runtime/queries/zig/textobjects.scm
@@ -0,0 +1,23 @@
+(TopLevelDecl (FnProto)
+ (_) @function.inside) @function.around
+
+(TestDecl (_) @test.inside) @test.around
+
+; matches all of: struct, enum, union
+; this unfortunately cannot be split up because
+; of the way struct "container" types are defined
+(TopLevelDecl (VarDecl (ErrorUnionExpr (SuffixExpr (ContainerDecl
+ (_) @class.inside))))) @class.around
+
+(TopLevelDecl (VarDecl (ErrorUnionExpr (SuffixExpr (ErrorSetDecl
+ (_) @class.inside))))) @class.around
+
+(ParamDeclList
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
+
+[
+ (doc_comment)
+ (line_comment)
+] @comment.inside
+(line_comment)+ @comment.around
+(doc_comment)+ @comment.around