summaryrefslogtreecommitdiff
path: root/vendor
diff options
context:
space:
mode:
Diffstat (limited to 'vendor')
-rw-r--r--vendor/queries/README.md7
-rw-r--r--vendor/queries/zig/textobjects.scm40
2 files changed, 45 insertions, 2 deletions
diff --git a/vendor/queries/README.md b/vendor/queries/README.md
index abd37d00..082f4e6b 100644
--- a/vendor/queries/README.md
+++ b/vendor/queries/README.md
@@ -8,8 +8,11 @@ is `helix.LICENSE` here. They give `]f`, `[f`, `mif` and the other
tree-sitter textobject keys what a function, class, argument, comment, test,
entry or element is.
+`zig/textobjects.scm` is helix's query MODIFIED by hand for the zig grammar
+pardes builds, which names its nodes differently; its header says how.
+
Not vendored: fortran, markdown and powershell (helix has no query for
-them), and erlang and zig, whose helix queries do not compile against the
-grammar versions pardes builds (a node name either side has renamed). Those
+them), and erlang, whose helix query does not compile against the grammar
+version pardes builds. Those
grammars have no textobjects, and the keys do nothing there, as in helix
without a query.
diff --git a/vendor/queries/zig/textobjects.scm b/vendor/queries/zig/textobjects.scm
new file mode 100644
index 00000000..1c40b137
--- /dev/null
+++ b/vendor/queries/zig/textobjects.scm
@@ -0,0 +1,40 @@
+; Adapted from helix (https://github.com/helix-editor/helix) at 278b24389:
+; runtime/queries/zig/textobjects.scm, MODIFIED for the zig grammar pardes
+; builds (maxxnino/tree-sitter-zig), whose node names differ from the
+; tree-sitter-grammars one helix uses: function_declaration is a Decl holding
+; an FnProto and a Block, with `pub` a sibling before it; variable_declaration
+; is VarDecl; struct/enum/union are one ContainerDecl; parameters and
+; arguments are ParamDeclList and FnCallArguments; comments come in three
+; kinds.
+; Licensed under the Mozilla Public License 2.0 (vendor/queries/helix.LICENSE,
+; https://mozilla.org/MPL/2.0/).
+
+(_
+ "pub"? @function.around
+ .
+ (Decl
+ (FnProto)
+ (Block) @function.inside) @function.around)
+
+(TestDecl (Block) @test.inside) @test.around
+
+; matches all of: struct, enum, union (one ContainerDecl in this grammar),
+; `pub` with them where there is one
+(_
+ "pub"? @class.around
+ .
+ (Decl
+ (VarDecl
+ (ErrorUnionExpr
+ (SuffixExpr
+ (ContainerDecl
+ [(ContainerField) (Decl) (TestDecl) (ComptimeDecl)] @class.inside))))) @class.around)
+
+(ParamDeclList
+ ((ParamDecl) @parameter.inside . ","? @parameter.around) @parameter.around)
+
+(FnCallArguments
+ ((_) @parameter.inside . ","? @parameter.around) @parameter.around)
+
+[(line_comment) (doc_comment) (container_doc_comment)] @comment.inside
+[(line_comment) (doc_comment) (container_doc_comment)]+ @comment.around