I am new to Neovim and wanted some help. I have been looking around but I could not find documentation on how to add an LSP that isn't preconfigured inside nvim-lspconfig.

I have been trying to get Unity's shaderlab/HLSL LSP support in Neovim.

  • "Non-standard LSP" sounds like an oxymoron. LSP exists solely to standardize things. In any case, study nvim-lspconfig a bit more? Then skim through :h lsp.txt. It'll take some time to wrap your mind around it, but then you can use any fully-implemented LSP server with neovim. Try setting up LSP for C++ first. It's hard enough that you'll have to really understand things, but it's also popular enough that you'll have enough guides. Hope it works out.
    – 3N4N
    Commented Aug 29, 2023 at 16:46
  • Do you mean your using LazyVim? Commented Aug 29, 2023 at 17:29
  • Ah, thank you. That's very helpful, I will do exactly that. I'm sure I could work it out after doing it. And I did mean I was using LazyVim
    – Andrew
    Commented Aug 31, 2023 at 1:12

1 Answer 1


You must do something like this (this example is for a different LSP, please adapt accordingly):

require('lspconfig.configs').templ = {
  default_config = {
    cmd = {"templ", "lsp"},
    filetypes = {'templ'},
    root_dir = lspconfig.util.root_pattern("go.mod"),
    settings = {},

Notice how you specify how to start the LSP server, the filetypes for which it will be active and the files that must be present at the root of your project for it to be active.

To set the filetype based on an extension in case Neovim doesn't do that for you, something like this:

vim.cmd([[autocmd BufRead,BufNewFile *.templ setfiletype templ]])

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.