Since regex is almost always injected into other languages,
`pattern_character`s will inherit the highlight for the structure that
injects them (for example `/foo/` in JavaScript or `~r/foo/` in Elixir).
This removes the string highlight when used in the prompt.
We also add `ERROR` node highlighting so that errors in regex syntax
appear in the prompt. This resolves a TODO in the `regex_prompt`
function about highlighting errors in the regex.
* 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
* Change Odin grammar to `ap29600/tree-sitter-odin`
The previously adopted grammar, `MineBill/tree-sitter-odin`, is unmaintained and mentions my repository as an alternative source.
* update queries
* docgen
* fix queries
* Update runtime/queries/odin/highlights.scm
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* remove `ERROR` query for `odin`
* track the latest rev in `ap29600/tree-sitter-odin`
* runtime/queries/odin/highlights.scm: update rune highlight class
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
---------
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
Unlike other languages, in Go, switches themselves are not indented;
it's just each case body which is indented by one level:
switch foo {
case "bar":
baz()
}
As such, we shouldn't `@indent` for type_switch_statement nor
expression_switch_statement, as otherwise inserted lines show up as:
switch foo {
// inserted with "o"
case "bar":
// inserted with "o"
baz()
}
With the fix, the inserted lines are indented properly:
switch foo {
// inserted with "o"
case "bar":
// inserted with "o"
baz()
}
I also verified that indentation on selects similarly works well.
Thanks to Triton171 for helping with this fix.
The update includes a fix for comments in commit messages where there
was no space separating the '#' and the comment text.
The comment textobject can be useful occasionally to jump to the
summary part of the commit edit message.
Simple highlight query file with keywords and builtin types
matching. Many VHDL types however are defined in std libraries
which do not currently get matched on.
This is because the grammar doesn't consider them builtin types.
* Switch nix grammar repository location to the new repo. The author
has transferred the repository to 'nix-community'.
* Capture ':' and '...' as 'punctuation.delimiter'.
* Macros that start with underscore were incorrectly marked as
'comment.unused' rather than 'keyword.directive' due to an ordering
issue of those two patterns.
* Recognize escripts as Erlang by the shebang.
* Sort buildin functions alphabetically
* fix: Query float type like other numeric types
* Update tree-sitter-sql and update highlights.scm to match grammar
* highlight(scala): update to fix crash
tree-sitter-scala has recently add a fix to workaround segv crashes in other editors.
Not sure if it happens to Helix as well, but it's probably a good idea to use the latest.
* highlight(scala): String interpolator support
This captures String interpolator as `function`
Co-authored-by: Chris Kipp <ckipp@pm.me>
There have been a lot of changes in tree-sitter/tree-sitter-scala,
including partial support for Scala 3 syntax and breaking changes in
some of the nodes.
This bumps up the grammar to the latest, and adjusts the queries.
Co-authored-by: Anton Sviridov <keynmol@gmail.com>
Co-authored-by: Chris Kipp <ckipp@pm.me>
The grammar now exposes the delimiter of raw-strings.
We can now inject the inner grammar in cases like:
const char* script = R"js(
alert('hello world!');
)js";