Open JeroenoBoy opened 1 month ago
I'm not familiar with this LS, but have you referenced their docs?
Syntax highlighting is usually a joint effort between treesitter and the LSP, however it's usually treesitter doing the heavy lifting; so this may not be an issue at all with your LSP config.
The issue isn't that there is no syntax highlighting, it seems like nvim handles it as a normal text file even though templ is enabled. No completions, no errors, nothing
Does the filetype
in the status line show as "plain text" then?
It's possible you need to manually configure the filetype for neovim to recognise it.
I'd check if the LS's docs talk about doing that. I'd also reference neovim's filetype docs and our docs for the filetype
option.
Thank you for the help!
It seems like adding these 2 lines did the trick. Is it possible to add these by default when enabling templ to avoid future confusion?
filetype.extension.templ = "templ";
plugins.lsp.servers.templ.filetypes = ["templ"];
Unlike home-manager and nixos, we try not to configure things by default. Instead we follow the principle that only what is explicitly configured will end up in init.lua
.
Ideally, the upstream plugins would resolve these issues, not nixvim.
Googling around, it seems tj has an example config/plugin for templ here: https://github.com/tjdevries/templ.nvim/blob/master/plugin/templ.lua
@traxys what're your thoughts? Can we add warnings/docs for this? Or maybe should we consider having an option to configure some of this automatically?
Or is there a plugin we could package that sets up a basic stuff like the filetype? If we had a plugins.templ
then we could recommend using that when using this LSP.
@traxys what're your thoughts? Can we add warnings/docs for this? Or maybe should we consider having an option to configure some of this automatically?
Do we have a hook to add some general info about a LS in the documentation ? I don't think to...
I was thinking of something like meta.description
for plugins.
I was thinking of something like
meta.description
for plugins.
This may work. We refactored how the docs handles meta
a while back to allow setting a URL for language-servers: https://github.com/nix-community/nixvim/pull/1646
If it doesn't work, the change needed in the docs should be trivial.
I think this should indeed belong to documentation of the LSP (in nixvim)
24.05
Description
When enabling the templ LSP in the nix config, switching, opening a .templ file, it only shows white text, I'm not sure why this happens since everything else just works after enabling the LSP
Minimal, Reproducible Example (MRE)
Enable the Templ LSP server, then open a .templ file in a go project with templ installed