mirror of https://github.com/helix-editor/helix
docs: another injection query example (#13312)
parent
d24e4fcf0f
commit
8b952bb1d5
|
@ -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
|
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.
|
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
|
```scm
|
||||||
((string_expression (string_fragment) @injection.content)
|
((string_expression (string_fragment) @injection.content)
|
||||||
(#set! injection.language "bash"))
|
(#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
|
## Capture Types
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue