neovim / nvim-lspconfig

Quickstart configs for Nvim LSP
Apache License 2.0
10.25k stars 2.04k forks source link

Breaking Changes & News: Follow for Updates #1075

Closed mjlbach closed 2 years ago

mjlbach commented 3 years ago

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

mjlbach commented 3 years ago

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.

mjlbach commented 2 years ago

The autostart function was internally renamed to launch in https://github.com/neovim/nvim-lspconfig/pull/1356

mjlbach commented 2 years ago

The documentation has been completely overhauled:

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

mjlbach commented 2 years ago

I'm planning on merging https://github.com/neovim/nvim-lspconfig/pull/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.

mjlbach commented 2 years ago

Some news:

What's next?:

mjlbach commented 2 years ago

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.

mjlbach commented 2 years ago

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.

mjlbach commented 2 years ago

https://github.com/neovim/nvim-lspconfig/pull/1518 updates the fsharpautocomplete's binary name, make sure you update to the latest version or override cmd in setup for backwards compatibility.

mjlbach commented 2 years ago

Windows users:

https://github.com/neovim/nvim-lspconfig/pull/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.

clason commented 2 years ago

Since nvim-lspconfig now requires Neovim 0.6.0, the compatibility shims for the pre-0.5.1 handler signature were removed in https://github.com/neovim/nvim-lspconfig/commit/4edd1a7a51a9d7298706501066ead7e2c2703285.

mjlbach commented 2 years ago

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

mjlbach commented 2 years ago

https://github.com/neovim/nvim-lspconfig/pull/1583 flux-lsp was renamed to flux_lsp. Please update your configuration accordingly.

mjlbach commented 2 years ago

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
}
mjlbach commented 2 years ago

https://github.com/neovim/nvim-lspconfig/pull/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.

mjlbach commented 2 years ago

Volar language server was renamed, please update to the latest release. See: https://github.com/neovim/nvim-lspconfig/pull/1770

mjlbach commented 2 years ago

Neovim 0.7 is out today. Two major improvements are the lua autocommands and lua user_commands API. I'm planning on merging https://github.com/neovim/nvim-lspconfig/pull/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.

You can follow https://github.com/neovim/nvim-lspconfig/pull/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' }