aboutsummaryrefslogtreecommitdiff
path: root/book/src
diff options
context:
space:
mode:
authorGokul Soumya2022-02-11 03:31:52 +0000
committerBlaž Hrastnik2022-02-15 05:04:46 +0000
commitab2a0f325b906574698933824b381ed65c7482a3 (patch)
treee48dc274f88f14e79e695a27442d5b07a01e2a6b /book/src
parent989407f190d543154e33630b07f4a53d13798d72 (diff)
Add object.movement for tree-sitter navigation
Diffstat (limited to 'book/src')
-rw-r--r--book/src/guides/textobject.md15
-rw-r--r--book/src/usage.md2
2 files changed, 16 insertions, 1 deletions
diff --git a/book/src/guides/textobject.md b/book/src/guides/textobject.md
index dd726b7c..7200a514 100644
--- a/book/src/guides/textobject.md
+++ b/book/src/guides/textobject.md
@@ -24,7 +24,22 @@ The following [captures][tree-sitter-captures] are recognized:
[Example query files][textobject-examples] can be found in the helix GitHub repository.
+## Queries for Textobject Based Navigation
+
+[Tree-sitter based navigation][textobjects-nav] is done using captures in the
+following order:
+
+- `object.movement`
+- `object.around`
+- `object.inside`
+
+For example if a `function.around` capture has been already defined for a language
+in it's `textobjects.scm` file, function navigation should also work automatically.
+`function.movement` should be defined only if the node captured by `function.around`
+doesn't make sense in a navigation context.
+
[textobjects]: ../usage.md#textobjects
+[textobjects-nav]: ../usage.md#tree-sitter-textobject-based-navigation
[tree-sitter-queries]: https://tree-sitter.github.io/tree-sitter/using-parsers#query-syntax
[tree-sitter-captures]: https://tree-sitter.github.io/tree-sitter/using-parsers#capturing-nodes
[textobject-examples]: https://github.com/search?q=repo%3Ahelix-editor%2Fhelix+filename%3Atextobjects.scm&type=Code&ref=advsearch&l=&l=
diff --git a/book/src/usage.md b/book/src/usage.md
index 3f9499ca..039628bf 100644
--- a/book/src/usage.md
+++ b/book/src/usage.md
@@ -75,7 +75,7 @@ document and a special tree-sitter query file to work properly. [Only
some grammars][lang-support] currently have the query file implemented.
Contributions are welcome!
-## Tree-sitter Based Navigation
+## Tree-sitter Textobject Based Navigation
Navigating between functions, classes, parameters, etc is made
possible by leveraging tree-sitter and textobjects queries. For