Multiple issues setting up LSP

Hi, I’ve been trying to set up the LSP with treesitter and I’m having a laundry list of issues. Hoping someone can help:

  • The Rust LSP doesn’t start automatically; however, if I run LspStart Rust followed by LspInfo, I can see that rust_analyzer has autostart set to true.
  • The zig LSP won’t start at all. Running LspStart zig does nothing, and running LspInfo shows that no filetype is detected while editing a .zig file.
  • TreeSitter doesn’t seem to work at all. Running TSInstallInfo shows that modules are installed for every language, but running TSStart zig on a .zig file does nothing.

My config files are:

  • init.vim
let g:do_filetype_lua = 1

call plug#begin("~/.config/nvim/plugged")
   Plug 'neovim/nvim-lspconfig'
   Plug 'williamboman/nvim-lsp-installer'
   Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
call plug#end()

lua require("config")
  • tls.lua
require("nvim-lsp-installer").on_server_ready(function(server)
   local opts = {}

   server:setup(opts)
end)
  • treesitter.lua
require'nvim-treesitter.configs'.setup {
  ensure_installed = "all",
  sync_install = false,

  highlight = {
    enable = true,

    disable = {},

    additional_vim_regex_highlighting = true,
  },
  indent = {enable = true}
}

Any help here would be much appreciated

Did you first try starting with the minimal config suggested in the lspconfig wiki?

I decided not to use the minimal config since I knew lspconfig was working, and because it would cause lsp_installer to load LSPs twice.

However, I visited the github for the zls, and it turns out that it depends on zig.vim. After I install that, opening a .zig file always gives me an error:

Spawning language server with cmd: `zls` failed. The language server is e
ither not installed, missing from PATH, or not executable. 

Then I press enter and ZLS works perfectly. Running :LspInfo says that the client zls is running and with cmd: zls. I think this has something to do with the order the dependency is loaded, but I’m not sure how to fix this.

edit: I’m pretty sure that’s the issue. Starting nvim and then calling :e a.zig results in no error

edit2: Sorry, I was just being stupid. For anyone coming from the future, the solution is just to install zig.vim.

Could always give GitHub - williamboman/nvim-lsp-installer: Neovim plugin that allows you to seamlessly manage LSP servers with :LspInstall. With full Windows support! a shot. Helped me a lot while trying to get OmniSharp for C# going.

The user is using nvim-lsp-installer

1 Like

well I just went with coc-nvim which is just so simple and easy to use treesitter is such a pain in the bottom

This topic isn’t about treesitter, treesitter has nothing to do with LSP.