From 8b952bb1d5560bda283bf81d2a95cec62e031e09 Mon Sep 17 00:00:00 2001 From: Niklas Gruhn Date: Wed, 9 Apr 2025 14:30:11 +0200 Subject: [PATCH] docs: another injection query example (#13312) --- book/src/guides/injection.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/book/src/guides/injection.md b/book/src/guides/injection.md index 729a2c99e..c94dadba1 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