Closed okuuva closed 2 years ago
Since a recent update to treesitter and neovim, you can define @treesitter.object style highlights. You can change @field to return it to the original version.
Since a recent update to treesitter and neovim, you can define @treesitter.object style highlights. You can change @field to return it to the original version.
Could you give an example? I tried setting ["@field"] = { fg = colors.main.green },
in the custom_highlights
(don't want it really to be green but just to see the difference) but it doesn't seem to be working. Also tried ["@variable"]
and ["@variable.field"]
with no success. All the other custom_highlights
are working.
This was added in neovim 0.8.0, so I you need the nightly build. Also, your treesitter needs to be updated to the latest version. If you try TSField = { fg = colors.main.green }
, and it works, that means that you need newer versions of neovim or the treesitter plugin.
This was added in neovim 0.8.0, so I you need the nightly build. Also, your treesitter needs to be updated to the latest version. If you try
TSField = { fg = colors.main.green }
, and it works, that means that you need newer versions of neovim or the treesitter plugin.
I am running neovim 0.8.0 and latest (0.20.7) tree-sitter:
❯ nvim --version
NVIM v0.8.0
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by brew@Monterey
❯ brew info tree-sitter
==> tree-sitter: stable 0.20.7 (bottled), HEAD
Parser generator tool and incremental parsing library
And TSField = { fg = colors.main.green }
isn't working either.
Confusion intensifies. Some of the new style TS highlight groups work, others don't:
As you can see from e.g. vim
variable on the very last line, the ["@variable"] = { fg = colors.main.green },
works just fine. But the rest of them don't. nil
under the cursor should be green but it isn't. Same goes for WinSeparator
et al. Which are oddly enough both @variable
and @field
but still not affected by neither custom highlight groups:
That's weird. ["@constant.builtin"] = { fg = colors.main.green }
works just fine for me and makes the nil value green. As far as some treesitter highlights using the new @name
group, and some using the old TSName
group, I believe that that's an upstream issue with treesitter. Is your treesitter updated to the latest version?
I don't think it's some TS highlights using the new group and some old. I tried setting TSConstantBuiltin = { fg = colors.main.green },
and that didn't have an effect either.
Treesitter is installed from homebrew and sits at version 0.20.7. nvim-treesitter/nvim-treesitter
is at latest HEAD.
I think I'll try to create a minimal config with just treesitter and material installed and see if I can repro. My best guess atm is that some other plugin is messing with the hlgroups. Would be nice to see what the hlgroup is set to and what set it...
No luck. Some of the overrides do not work even with just packer
, material
and nvim-treesitter
installed.
Here's the config I used:
And here's a screenshot from the end result:
I also tried setting ["@boolean"] = { fg = "#FF00FF"},
and that works so it seems that the problem might lie with @group.subgroup
type of hl groups.
While this is interesting it's also frustrating. I would be happy to just get the @field
to the way it was.
This is really weird. I'm trying to reproduce the issue, but just can't do it. When I use
custom_highlights = {
["@field"] = { fg = colors.main.green },
["@function.builtin"] = { fg = colors.main.red }
}
everything works just fine. This could be due to another plugin, or the order in which plugins get loaded.
I thought so too, but the minimal config I have in the previous comment doesn't load anything but packer, material and nvim-treesitter (in that order). Still setting "@field" or "@constant.builtin" doesn't work for me. Tried it with my home server running Debian and the same result (installed neovim, tree-sitter and luajit from homebrew with --HEAD) so it's not tied to OS either. There must be something simple I'm missing...
I'll look further into this. For now I have no idea what could be causing this.
Now it works, takkâ ennuv! (Thank you very much!)
It used to be the same color as "@variable" (like "colors" and "material" in the sample pic) but now it defaults to the same color as comments:
Would be very nice to be able to define "@treesitter.object" style highlights in
custom_highlights
but that's a whole another thing.