Commit Graph

6 Commits (87a720c3a13ccc7245f5b0befc008db5bd039032)

Author SHA1 Message Date
pacien 37e48f4307 queries/nix: align match start for language comments
This rule failed to override other ones because it started its
matching later.
1 year ago
pacien b4494e1dc5 queries/nix: add injection rule for python test scripts 1 year ago
Timothy DeHerrera 9c6c63a2be
inject language based on file extension & shebang (#3970)
* inject language based on file extension

Nodes can now be captured with "injection.filename". If this capture
contains a valid file extension known to Helix, then the content will
be highlighted as that language.

* inject language by shebang

Nodes can now be captured with "injection.shebang". If this capture
contains a valid shebang line known to Helix, then the content will
be highlighted as the language the shebang calls for.

* add documentation for language injection

* nix: fix highlights

The `@` is now highlighted properly on either side of the function arg.

Also, extending the phases with `buildPhase = prev.buildPhase + ''''`
is now highlighted properly.

Fix highlighting of `''$` style escapes (requires tree-sitter-nix bump)

Fix `inherit` highlighting.

* simplify injection_for_match

Split out injection pair logic into its own method to make the overall
flow easier to follow.

Also transform the top-level function into a method on a
HighlightConfiguration.

* markdown: add shebang injection query
2 years ago
pacien 22b3d3d636
queries/nix: add injections for builtins and writers (#5629) 2 years ago
farwyler a7146f58f0
Add missing comment injection for nix (#5208) 2 years ago
Timothy DeHerrera 665e27ff9d nix: add language injections
By simply placing a comment with the name of the desired language just
before a multi-line string, that language will be injected.

Also, common functions and attributes which are expected to be shell
code are automatically injected.
2 years ago