Zulip Chat Archive

Stream: general

Topic: lean.nvim semantic tokens


Calvin Lee (Sep 01 2023 at 13:08):

there have been a few threads scattered about semantic highlighting in vim not working.
In particular, I am using NVIM v0.9.1, which has semantic highlighting built-in, but am not receiving highlights from it even after following instructions on the wiki: https://github.com/Julian/lean.nvim/wiki/Configuring-&-Extending#semantic-highlighting

For example, if i hover over a keyword that is not highlighted and type :Inspect I receive

Semantic Tokens
  - @lsp.type.keyword.lean links to @lsp priority: 125

but have no syntax highlighting at this node.

Any idea what I am doing wrong?

Julian Berman (Sep 01 2023 at 15:22):

Hrm. Can you say more about your color scheme perhaps? Maybe it doesn't define any colors for any treesitter nodes (which obviously we should mention in the wiki, that's what the instructions are relying on existing, which most modern color schemes normally define AFAIK).

But if you perhaps type :highlight link @lsp.type.keyword String or :highlight link @lsp.type.keyword Comment do you see any change in color?

Calvin Lee (Sep 01 2023 at 15:34):

yeah, my colorscheme supports treesitter
but i found an issue referencing semantic tokens https://github.com/RRethy/nvim-base16/issues/65
odd that this would be colorscheme dependent even if you :hi link

Calvin Lee (Sep 01 2023 at 15:35):

linking to string and comment definitely works

Calvin Lee (Sep 01 2023 at 15:39):

but that's not what the wiki suggests
the wiki code runs something akin to

highlight link @keyword LspKeyword

but what you suggested (that works) is

highlight link @lsp.type.keyword LspKeyword

Julian Berman (Sep 01 2023 at 16:08):

The reverse, the wiki runs highlight link LspKeyword @keyword -- so it sounds like you have some color defined for LspKeyword and not for @keyword (which IIRC is a tree-sitter color)

Julian Berman (Sep 01 2023 at 16:16):

It looks like perhaps what happened is the Lsp* names got renamed to @lsp.whatever as part of the merge to neovim (i.e. when it was moved from the plugin). So probably the wiki need to be updated to use those names instead. Certainly happy with you editing it if you see what's working now for you, or I can figure out what the tweak is, but it should basically be e.g. renaming LspKeyword to @lsp.type.keyword and doing that for all the kinds that Lean uses


Last updated: Dec 20 2023 at 11:08 UTC