Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to vim.lsp.config (non-breaking) #3494

Open
justinmk opened this issue Dec 6, 2024 · 4 comments
Open

Migrate to vim.lsp.config (non-breaking) #3494

justinmk opened this issue Dec 6, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@justinmk
Copy link
Member

justinmk commented Dec 6, 2024

Description

With vim.lsp.config neovim/neovim#31031 , Nvim 0.11+ now has an interface for defining LSP configs. Previously, the config format was defined by nvim-lspconfig (this repo) and did not have core Nvim support.

Migration plan

Phase 1: Nvim 0.11 users can use these configs via vim.lsp.config

  1. Create lsp/*.lua configs (in this repo) that simply wrap the existing lua/lspconfig/configs/*.lua configs.
    • Ignore root_dir? Copy-paste filenames into root_markers?
  2. Upstream relevant parts of the healthcheck.
    • On Nvim 0.11 lspconfig/health.lua should do nothing (or error). On Nvim 0.10 it will continue to work.
  3. Nvim 0.11+ can use nvim-lspconfigs like this:
    vim.lsp.config('foo')
  4. Nvim 0.11+ users no longer need to (directly) call require('lspconfig') for any reason.

Phase 2: migrate the actual config code

  1. Tag a v1.x release.
  2. BREAKING: The master branch will require Nvim 0.11 and will throw an error if vim.lsp.config is not found (and point the user to the v1.x branch).
  3. Keep the old configs on master, but document that they are frozen and won't be supported.
  4. If Nvim 0.10 or older is detected, use the old frozen configs
  5. Update the README to mention that old configs are frozen.
  6. Copy all configs to lsp/*.lua and port them to vim.lsp.config
@justinmk justinmk added the enhancement New feature or request label Dec 6, 2024
@justinmk justinmk pinned this issue Dec 6, 2024
@justinmk

This comment has been minimized.

@justinmk justinmk changed the title BREAKING: migrate to vim.lsp.config migrate to vim.lsp.config (non-breaking) Dec 6, 2024
@glepnir

This comment has been minimized.

@justinmk
Copy link
Member Author

justinmk commented Dec 6, 2024

hope we can have a naming standard for new.. xx_ls, xx_lsp, xx is a mess for now

Why does it matter?

@justinmk
Copy link
Member Author

justinmk commented Dec 6, 2024

idea from @lewis6991 :

I'm pretty sure that lsp/clangd.lua just needs to contain:

vim.lsp.config('clangd', require('lspconfig.configs.clangd').default_config)

We might need some adapter in between for some places, but I think this method will be much less work than just freezing the whole thing.

E..g root_dir is provided as a function instead of root_markers, which tbh core should support.

counterpoint:

default_config in lspconfig contains the commands stuff that are user commands instead of lsp commands, so some kind of adapter will be needed

@justinmk justinmk changed the title migrate to vim.lsp.config (non-breaking) Migrate to vim.lsp.config (non-breaking) Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants