Closed V13Axel closed 1 month ago
Hey @V13Axel sorry for the delay! So I did a quick copy and paste in helix. the parser seems to be working fine with no errors, including the injections.
Very likely could be whatever theme or plugin that underlines, make things bold that is causing the issue? Can you change the theme and see if it works?
I had a similar issue with the plugin i was developing for Nova a while back, the brackets can be picked up by the themes if needed #36
This is with Catppuccin Mocha
Do you get any parsing error? See if you can exclude the php
node from the plugin/theme? unfortunately I am not a NeoVim user but super likely it is fixable!
Interestingly, I also use Catppuccin Mocha, just in Neovim (and everywhere else I can)
I'll see if I can give it a closer look later on - It looks to me like it's an attempt at making the text bold, so there's probably some configuration option there I need to manage
Yea, see what plugin is responsible for the underline/bolding.
Also as you can see in my example the brackets are not highlighted correctly. I just haven't had a chance to mess with the theming in Helix, but if you are interested you can try to grab the brackets and apply the correct theme to them. The nodes are bracket_start
and bracket_end
👍
This was the case in Nova, and it is now highlighting correctly.
Ok so for posterity in case anyone else hits this - The bold/red coloration was definitely from something trying to make the text bold. In my case, I just disabled that in Catppuccin's configuration as such:
require("catppuccin").setup({
-- {snip} --
no_bold = true,
})
and that solved the red+bold.
However, despite setting overrides for the @bracket_start
and @bracket_end
highlight groups (and confirming they are available as highlights via :Telescope highlights
), the brackets don't appear to be targeted by those at all. :thinking:
Running :Inspect
with my cursor on the opening brackets gives me:
- @none.html links to @none html
- @spell.html links to @spell html
- @markup.strong.html links to @markup.strong html
and the closing brackets just says No items found at position 0,65 in buffer 1
.
However, the bracket_start
and bracket_end
nodes do appear in :InspectTree
... So I'm a tad baffled at this point, but will keep digging.
@V13Axel Mmm, maybe it is a precedence thing, are the queries in the runtime
or something similar?
I actually just fixed that for the Helix editor as it was doing my head, which just got merged a few minutes ago! Have a look and see if Neovim is similar? Make sure you are grabbing the brackets in the highlights.scm
and find the appropriate selectors/scope
that nvim
uses. That bit is different for each editor I am afraid, so it is not a drag and drop solution for that part
Only just got back around to this, and it looks like adding the brackets to highlights.scm
was exactly what was needed! I should probably do a deeper dive into how some of this stuff works.
My final highlights.scm
looks like this:
(directive) @tag
(directive_start) @tag
(directive_end) @tag
(comment) @comment @spell
[
(bracket_start)
(bracket_end)
] @punctuation.bracket
Thanks again!
Highlighting is working great just about everywhere, but seems to be overridden by formatting from HTML when the blade syntax is contained within a
strong
tag.A file containing the following:
Shows up like this in my editor (neovim, config here):
On some further inspection, the same appears to happen for the contents of
<a>
tags andhref
attributes:I would expect the PHP in those cases to be highlighted as simple PHP, but it appears that the HTML parser is trying to underline anything it considers a link, and make the contents of the
strong
tag as bold (and red in my case). Then, to complicate matters further, it seems encountering any>
confuses it further.That said, I'm not familiar enough with the interplay between tree-sitter parsers to know if that's something the
tree-sitter-blade
can/should change.