nvarner / typst-lsp

A brand-new language server for Typst, plus a VS Code extension
MIT License
1.15k stars 78 forks source link

Insufficient highlighting in neovim #297

Closed sproott closed 10 months ago

sproott commented 10 months ago

Issue

Highlighting in neovim is almost non-existent compared to VSCode. I have tried different color schemes, but nothing works.

neovim:

image

VSCode:

image

Logs

KillTheMule commented 10 months ago

typst-lsp does send the necessary information though. Put you cursor on the +, run :Inspect, and you should be able to see that it's a semanctic token of type @lsp.type.marker.typst. It's just not highlighted because it does not have a highlight group set. Try, e.g. lua vim.api.nvim_set_hl(0, '@lsp.type.marker.typst', { link = "Error", default = true }), and it will be highlighted as an error. Doing this config properly isn't the job for the lsp. Maybe open a feature request at https://github.com/kaarmu/typst.vim for this.

sproott commented 10 months ago

I'm using neovim-lspconfig to set up the LSP, I don't have the typst.vim plugin. But the LSP should be enough. I'm not sure how neovim-lspconfig handles highlighting, but I'll maybe just open an issue there and see if there's something to be done there.

KillTheMule commented 10 months ago

But the LSP should be enough.

That's wrong. The LSP needs to send the token information, but doing the highlighting from that information is the job of the client.

neovim-lspconfig

It doesn't. There's some blanket configuration in neovim itself (runtime/lua/vim/lsp/semantic_tokens.lua), but not in neovim-lspconfig. For some reason, the blanket configuration doesn't really apply here (I've no idea why, seems to me the above should link to Type), but it's still a client problem, not a server problem.

sproott commented 10 months ago

Closing as the LSP server is working properly.