diff options
author | Gregory Anders <greg@gpanders.com> | 2024-12-21 08:27:27 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-21 08:27:27 -0600 |
commit | 130b5fd85f074ac5e40cb4b07c6c9dc6f91512bd (patch) | |
tree | ff3f22ad9316edb6ff26b4b9260b979aa333083f /runtime/doc | |
parent | 382eb878bcbfba3b11d9c2deb21928e5319b32ad (diff) | |
download | rneovim-130b5fd85f074ac5e40cb4b07c6c9dc6f91512bd.tar.gz rneovim-130b5fd85f074ac5e40cb4b07c6c9dc6f91512bd.tar.bz2 rneovim-130b5fd85f074ac5e40cb4b07c6c9dc6f91512bd.zip |
feat(lsp): return table from lsp/ files on runtimepath (#31663)
Problem: LSP configs on the runtimepath must have the same name as the
LSP server and must also explicitly set the name in vim.lsp.config. This
is redundant and creates a footgun where a user may accidentally use the
wrong name when assigning to the vim.lsp.config table.
Solution: Return a table from lsp/ runtimepath files instead
Diffstat (limited to 'runtime/doc')
-rw-r--r-- | runtime/doc/lsp.txt | 12 | ||||
-rw-r--r-- | runtime/doc/news.txt | 6 |
2 files changed, 10 insertions, 8 deletions
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 228bbafdd2..8b822daf9e 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -74,12 +74,8 @@ configurations, in increasing priority, from the following: 1. Configuration defined for the `'*'` name. -2. Configuration from the result of sourcing all `lsp/<name>.lua` files - in 'runtimepath' for a server of name `name`. - - Note: because of this, calls to |vim.lsp.config()| in `lsp/*.lua` are - treated independently to other calls. This ensures configurations - defined in `lsp/*.lua` have a lower priority. +2. Configuration from the result of merging all tables returned by + `lsp/<name>.lua` files in 'runtimepath' for a server of name `name`. 3. Configurations defined anywhere else. @@ -102,11 +98,11 @@ Given: >lua }) -- Defined in ../lsp/clangd.lua - vim.lsp.config('clangd', { + return { cmd = { 'clangd' }, root_markers = { '.clangd', 'compile_commands.json' }, filetypes = { 'c', 'cpp' }, - }) + } -- Defined in init.lua vim.lsp.config('clangd', { diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 011970f5eb..eb04702ec2 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -22,6 +22,12 @@ EXPERIMENTS • Removed `vim.loader.disable()`. Use `vim.loader.enable(false)` instead. +LSP + +• `lsp/` runtimepath files should return a table instead of calling + |vim.lsp.config()| (or assigning to `vim.lsp.config`). See |lsp-config| + + OPTIONS • 'jumpoptions' flag "unload" has been renamed to "clean". |