Neovim + LanguageServer.jl crashing again

Specifically, the way the Mason folks rewrote the Julia LS launch config to work with the new neovim 0.11+ built-in LSP functionality (which is what the v2 release was about) is built on a subtle misunderstanding of the nvim LSP docs. They didn’t use this approach for any other LS’s, which I guess is why they didn’t realize that it doesn’t work. It’s not hard to fix, just need a sec to try out a couple of alternative approaches and make a PR.

In the meantime, as @jling said, the solution is to not install Julia LS via mason, but rather set it up yourself with the help of nvim-lspconfig. That means

  • Create a shared Julia environment @nvim-lspconfig and manually install LanguageServer.jl in it: julia --project=@nvim-lspconfig -e 'Using Pkg; Pkg.add("LanguageServer")'
  • Make sure nvim-lspconfig is installed
  • Add the line vim.lsp.enable("julials") somewhere in your neovim configuration, for example where you install nvim-lspconfig (if you use lazy.nvim, I’d add it to either the init or opts function in the nvim-lspconfig entry).
    • Note that vim.lsp.enable(server) doesn’t launch the server, it just tells neovim to automatically launch it once you open a relevant file type, so don’t worry about only running the command conditionally on .jl files or anything like that.
4 Likes