neovim/nvim-lspconfig

Breaking Changes & News: Follow for Updates

mjlbach opened this issue · 16 comments

Please follow this issue if you would like to be updated on breaking changes and news for lspconfig.

pyls_ms and pyls were deprecated in #1074

Both servers are unmaintained, and pyls has been fork into the community maintained pylsp, which we have support for in lspconfig.

The autostart function was internally renamed to launch in #1356

The documentation has been completely overhauled:

  • README.md -> high level quickstart/help resources
  • lspconfig.txt (:help lspconfig) -> extremely detailed readme

CONFIG.md has also been renamed server_configurations.md and moved under doc so it is accessible directly from the new vimdoc with gf.

I'm planning on merging #1385 soon. This will remove all util.path.dirname/vim.fn.cwd() fallbacks in favor of a scratch server mechanism which should universally work.

Some servers will crash if we do not send a root directory in the start process. I had to screen through the ones that implemented dirname fallbacks, and I believe this subset works. The feature can conditionally be enabled on additional servers with testing. Your workflow will not likely be impacted by this change. You may all now edit main.py in your home directory with ease.

Please test the branch. An example with packer:

  use {
    'mjlbach/nvim-lspconfig', branch = 'feat/PURGE'
  }

I'll post a follow-up announcement once merged.

Some news:

  • single file support was merged. Now you should never include vim.fn.cwd() or util.path.dirname in a root pattern (it's not necessary!). You can read :help lspconfig to learn more about root patterns, what value they add, and what single file support is.
  • There's a huge backlog of server PRs, if there's a server you particularly want please test the PRs. If you have an outstanding PR that you feel has been ignored, you can tag me for review. nvm, I took care of it.
  • I'm generally looking for helpers to test PRs for me, I use only about 5 languages regularly, and it takes a lot of time validating each server configuration/learning about it's root patterns before merged.

What's next?:

  • I'm planning on cutting the 0.1.0 release of lspconfig when neovim 0.6 is released later this month. Generally I will cut releases around the time of the next neovim release.
  • We're down to less than 50 issues across lspconfig and core, which I consider to be a big milestone. Consequently, I'm planning to focus more on user experience for the 0.7 release cycle with the aim to finish the lspconfig rewrite around 0.8. The main focus of the rewrite is getting everything but server configurations ready to merge into neovim core. At which point, lspconfig will be a bag of configs that will serve as a nice backup if there is not a dedicated language extension (or, if you just don't care for fancy features and just want to get language servers up and running quickly)
  • Once the non-server configurations part of lspconfig is moved into core, it should be significantly easier to write a language server extension for the neovim ecosystem. Commiserately, I will be writing extensive documentation on an extension template (including code design, documentation)

It's been requested for awhile to directly expose configurations without activating them. I made this change in #1479. If your configuration breaks as a result of this change, let me know.

Several users are reporting issues with #1479. If you experience an issue like:

Error running config for nvim-lspconfig: ...pack/packer/opt/nvim-lspconfig/lua/lspconfig/configs.lua:10: attempt to index local 'config_def' (a nil value)

This is due to an additional validation check I added. The correct way to add a custom server to lspconfig is as follows:

local lspconfig = require('lspconfig')
local configs = require('lspconfig.configs')

-- note we are indexing configs here, not lspconfig
if not configs.golangcilsp then
  configs.golangcilsp = {
    default_config = {
      cmd = { 'golangci-lint-langserver' },
      root_dir = lspconfig.util.root_pattern('.git', 'go.mod'),
      filetypes = { 'go' },
      init_options = {
        command = { 'golangci-lint', 'run', '--fast', '--out-format', 'json' },
      },
    },
  }
end
lspconfig.golangcilsp.setup{}

This is documented in :help lspconfig-adding-servers.

Of note, this change also complete breaks nvim-lspinstall, which has been archived. If you want a plugin to manage your server installations, switch to nvim-lsp-installer which is maintained and does not suffer the issue.

#1518 updates the fsharpautocomplete's binary name, make sure you update to the latest version or override cmd in setup for backwards compatibility.

Windows users:

#1522 should resolve any remaining "default command does not work on windows issues". Please test before I merge (3 days to 1 week). I'd like to merge this before cutting the first official release.

Since nvim-lspconfig now requires Neovim 0.6.0, the compatibility shims for the pre-0.5.1 handler signature were removed in 4edd1a7.

#1522 was merged. You should be able to remove any windows specific overrides to cmd now.

#1583 flux-lsp was renamed to flux_lsp. Please update your configuration accordingly.

EFM now supports operating on single files.

Requires at minimum EFM version v0.0.38 to support launching the language server on single files. If on an older version of EFM, disable single file support:

require('lspconfig')['efm'].setup{
  settings = ..., -- You must populate this according to the EFM readme
  filetypes = ..., -- Populate this according to the note below
  single_file_support = false, -- This is the important line for supporting older version of EFM
}

#1593 was merged, which should fix all path issues on WIndows. Please file a bug report if this is not the case. Note lspconfig now assumes internally that all paths are normalized to use forward slashes, for which we provide util.path.sanitize. This only applies to external users of these utility functions, the internal usage should still be correct.

Volar language server was renamed, please update to the latest release. See: #1770

Neovim 0.7 is out today. Two major improvements are the lua autocommands and lua user_commands API. I'm planning on merging #1838 within the next week which will break backwards compatibility with Neovim < 0.7. This will be the first minor patch version update of lspconfig (we follow semantic versioning) to lspconfig 0.2.0.

There will be two breaking changes in the update.

  • Neovim 0.6 compatibility will be dropped to allow passing closures via the lua autocommands API, this dramatically simplifies the lspconfig codebase in certain parts.
  • The commands field of setup will be renamed user_commands to distinguish from the commands field that start_client takes. The new user_commands field will have a different structure, instead taking a list of tables of the form that matches vim.api.nvim_create_user_command
  user_commands = {
     {
      name = "TexlabBuild"
      command = function()
        buf_build(0)
      end,
      opts = {
         desc = "Build the current buffer",
      }
    },
  },

You can follow #1838 to know when it is merged, and leave feedback if you disagree with the change to user_commands.

I won't consider a backport branch for 0.6 compatibility, you will need to pin to lspconfig's release branch v0.1.3

Here is how you can pin with packer.nvim:

use {
    'neovim/nvim-lspconfig',
    tag = 'v0.1.3',
}

and with vim-plug:

Plug 'neovim/nvim-lspconfig', { 'tag': 'v0.1.3' }