3

enter image description here

" Spawning language server with cmd: diagnostic-languageserver failed. The language server is either not installed, missing from PATH, or not executable "

nvim problem i copied devaslife's dotfiles and installed plugin yesterday it work, but today i entered LSP info after that when i Enter shows that the error

Gowtham V
  • 67
  • 1
  • 2
  • 7

5 Answers5

4

I've resolved this problem by executing the below command

npm install -g diagnostic-languageserver
Prem Ukkoji
  • 91
  • 1
  • 2
2

Use this:

yarn global add diagnostic-languageserver
Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
Carlos
  • 21
  • 1
  • 3
    See "[Explaining entirely code-based answers](https://meta.stackoverflow.com/q/392712/128421)". While this might be technically correct, it doesn't explain why it solves the problem or should be the selected answer. We should educate along with helping solve the problem. – the Tin Man Mar 22 '22 at 05:00
2

Probably, it's because you have not set up the right programming language that you are using in the lspconfig.rc.vim, precisely in the nvim_lsp.tsserver.setup part.

I had the same problem because I was in javascript file (.js) and the lsp config that I was using from someone else only supports typescript files. So, I just had to add the javascript, javascriptreact and javascript.jsx. For example :

nvim_lsp.tsserver.setup {
  on_attach = on_attach,
  filetypes = { "typescript", "typescriptreact", "typescript.tsx", "javascript", "javascriptreact", "javascript.jsx" },
  capabilities = capabilities
}
cigien
  • 57,834
  • 11
  • 73
  • 112
Eduardo
  • 21
  • 1
1

For windows you can use this:

nvim_lsp.tsserver.setup {
    on_attach = on_attach,
    filetypes = { "typescript", "typescriptreact", "typescript.tsx" },
    cmd = { "typescript-language-server.cmd", "--stdio" }
}

This will make sure it will run the .cmd file that is along side the .ps1.

shanytc
  • 11
  • 2
0

That is not working for me. In the lspconfig.re.vim, i had to delete the "javascipt", "javasriptreact", "javascript.jsx" types from the nvim_lsp.diagnosticls.setup/filetypes, and then put them in the nvim_lsp.tsserver.setup>filetypes

Giannis
  • 1
  • 1