Unnamed repository; edit this file 'description' to name the repository.
docs: another injection query example (#13312)
| -rw-r--r-- | book/src/guides/injection.md | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/book/src/guides/injection.md b/book/src/guides/injection.md index 729a2c99..c94dadba 100644 --- a/book/src/guides/injection.md +++ b/book/src/guides/injection.md @@ -4,11 +4,16 @@ Writing language injection queries allows one to highlight a specific node as a In addition to the [standard][upstream-docs] language injection options used by tree-sitter, there are a few Helix specific extensions that allow for more control. -And example of a simple query that would highlight all strings as bash in Nix: +An example of a simple query that would highlight all strings as bash in Nix: ```scm ((string_expression (string_fragment) @injection.content) (#set! injection.language "bash")) ``` +Another example is this query, which highlights links in comments and keywords like "TODO", by reusing the dedicated "comment" language: +``` +((comment) @injection.content + (#set! injection.language "comment")) +``` ## Capture Types |