From 827c9ac50694240b91fa43ae3457732c526b1bb4 Mon Sep 17 00:00:00 2001 From: omentic Date: Wed, 1 Nov 2023 04:44:44 +0000 Subject: deploy: 9663740245e2c18e160f6563d2f114f59d27b7c9 --- 23.10.1/guides/injection.html | 298 ------------------------------------------ 1 file changed, 298 deletions(-) delete mode 100644 23.10.1/guides/injection.html (limited to '23.10.1/guides/injection.html') diff --git a/23.10.1/guides/injection.html b/23.10.1/guides/injection.html deleted file mode 100644 index fb4bb8f3..00000000 --- a/23.10.1/guides/injection.html +++ /dev/null @@ -1,298 +0,0 @@ - - - - - - Adding injection queries - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- -
- - - - - - - - -
-
-

Adding Injection Queries

-

Writing language injection queries allows one to highlight a specific node as a different language. -In addition to the standard 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:

-
((string_expression (string_fragment) @injection.content)
-  (#set! injection.language "bash"))
-
-

Capture Types

-
    -
  • -

    @injection.language (standard): -The captured node may contain the language name used to highlight the node captured by -@injection.content.

    -
  • -
  • -

    @injection.content (standard): -Marks the content to be highlighted as the language captured with @injection.language et al.

    -
  • -
  • -

    @injection.filename (extension): -The captured node may contain a filename with a file-extension known to Helix, -highlighting @injection.content as that language. This uses the language extensions defined in -both the default languages.toml distributed with Helix, as well as user defined languages.

    -
  • -
  • -

    @injection.shebang (extension): -The captured node may contain a shebang used to choose a language to highlight as. This also uses -the shebangs defined in the default and user languages.toml.

    -
  • -
-

Settings

-
    -
  • -

    injection.combined (standard): -Indicates that all the matching nodes in the tree should have their content parsed as one -nested document.

    -
  • -
  • -

    injection.language (standard): -Forces the captured content to be highlighted as the given language

    -
  • -
  • -

    injection.include-children (standard): -Indicates that the content node’s entire text should be re-parsed, including the text of its child -nodes. By default, child nodes’ text will be excluded from the injected document.

    -
  • -
  • -

    injection.include-unnamed-children (extension): -Same as injection.include-children but only for unnamed child nodes.

    -
  • -
-

Predicates

-
    -
  • -

    #eq? (standard): -The first argument (a capture) must be equal to the second argument -(a capture or a string).

    -
  • -
  • -

    #match? (standard): -The first argument (a capture) must match the regex given in the -second argument (a string).

    -
  • -
- -
- - -
-
- - - -
- - - - - - - - - - - - - - - - - - -
- - -- cgit v1.2.3-70-g09d2