aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp.lua
Commit message (Collapse)AuthorAge
...
* fix(lsp): remove side-effects if `vim.lsp.enable()` raises an error (#37571)Olivia Kinnear2026-01-27
| | | | | | | | | | | | | | | | | Problem: If `vim.lsp.enable()` fails with an error, either because `'*'` is one of the provided names or because there is an error in a config, `vim.lsp.enable()` will still have side-effects: - All names before the one that encountered an error will still be added to `lsp._enabled_configs`, but the autocommand will not get added or run. - Any name which makes `vim.lsp.config[name]` error will be added to `lsp._enabled_configs`, causing all future calls to `vim.lsp.enable()` to fail. This will also break `:che vim.lsp`. Solution: - Check all names for errors before modifying `lsp._enabled_configs`. - Check `vim.lsp.config[name]` does not raise an error before enabling the name.
* fix(lsp): raise error when lsp config is invalid type (#37508)Olivia Kinnear2026-01-22
|
* docs: misc (#37281)zeertzjq2026-01-12
| | | | | | | Close #37289 Close #37348 Co-authored-by: Marc Jakobi <marc@jakobi.dev> Co-authored-by: Anton Kesy <anton@kesy.de>
* fix(lsp): improve dynamic registration handling #37161Tristan Knight2026-01-02
| | | | | | | | Work on #37166 - Dynamic Registration Tracking via Provider - Supports_Method - Multiple Registrations - RegistrationOptions may dictate support for a method
* feat(lsp): builtin :lsp commandbrianhuster2025-12-16
| | | | | | | | | | | | | Problem: - Despite [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) claims to be a "data-only" plugin, in fact it still provides some user-facing commands because they haven't been upstreamed to Nvim. Solution: - Upstream `:LspRestart`, `:LspStart` and `:LspStop` commands as `:lsp restart`, `:lsp start` and `:lsp stop` respectively. Co-authored-by: glepnir <glephunter@gmail.com>
* docs: miscJustin M. Keyes2025-12-06
| | | | | | fix https://github.com/neovim/neovim.github.io/issues/419 Co-authored-by: Rob Pilling <robpilling@gmail.com>
* feat(lsp): graduate ClientConfig `exit_timeout` #36750Olivia Kinnear2025-11-30
| | | | | | | | Problem: The `flags` field calls its sub-fields "experimental". But `exit_timeout` is now used for multiple purposes. Solution: Graduate `exit_timeout` to a top-level ClientConfig field.
* feat(lsp): lsp.enable() auto-escalates forced shutdown #36458Olivia Kinnear2025-11-29
| | | | | | | Problem: LSP server may not exit even after the client was stopped/disabled via enable(false). Solution: Automatically force-stop after a timeout, unless `client.flags.exit_timeout = false`.
* fix(lsp): check `nvim.lsp.enable` before `doautoall` #36518Maria Solano2025-11-11
|
* feat(lsp): deprecate `vim.lsp.stop_client` (#36459)Olivia Kinnear2025-11-10
| | | | | * feat(lsp): deprecate `vim.lsp.stop_client` * fix(tests): fix nil variable in diagnostic_spec.lua
* fix(lsp): deprecate `vim.lsp.get_buffers_by_client_id` (#36449)Maria Solano2025-11-10
|
* feat(lsp): support auto-force escalation in client stop (#36378)Maria Solano2025-11-01
|
* docs: types, news, lua-pluginJustin M. Keyes2025-10-24
| | | | | | - mention "lua_ls", not "luals". https://github.com/neovim/neovim/discussions/36182 Co-authored-by: Maria Solano <majosolano99@gmail.com>
* fix(lsp): noisy log message when enabling server without config #36264Riley Bruins2025-10-21
| | | | | | | | | | This warning doesn't really make sense, since the `enable()` call is meant to be run before the `lsp.config` calls. It will be logged many times (once for each enabled LSP) at startup. This is especially annoying because calling `enable()` after configuration causes the first opened buffer not to have its filetype set in some situations. This is a separate bug which really needs to be fixed, and makes this superfluous logging more likely.
* fix(lsp): replace `string` types with LSP method alias type annotations ↵David2025-10-16
| | | | | where appropriate. (#36180) fix(lsp): replace `string` types with LSP method alias where appropriate
* revert "fix(lsp): _get_workspace_folders does not handle root_dir() ↵Mathias Fußenegger2025-10-14
| | | | | | | function" #36183 This reverts commit 97ab24b9c7d9327740f0692f8076fed5737a52dc. See discussion in https://github.com/neovim/neovim/pull/36071
* fix(lsp): "attempt to index nil config" #36189Justin M. Keyes2025-10-15
| | | | | | | | | | | | | | | | | Problem: If a client doesn't have a config then an error may be thrown. Probably caused by: 2f78ff816b03661b5f74d0624e973eaca0d64ef1 Lua callback: …/lsp.lua:442: attempt to index local 'config' (a nil value) stack traceback: …/lsp.lua:442: in function 'can_start' …/lsp.lua:479: in function 'lsp_enable_callback' …/lsp.lua:566: in function <…/lsp.lua:565> Solution: Not all clients necessarily have configs. - Handle `config=nil` in `can_start`. - If user "enables" an invalid name that happens to match a *client* name, don't auto-detach the client.
* fix(lsp): _get_workspace_folders does not handle root_dir() function #36071atusy2025-10-11
| | | | | | | | | | | | | | | | * fix(lsp): type of root_dir should be annotated with string|fun|nil * feat(lsp): support root_dir as function in _get_workspace_folders * feat(lsp): let checkhealth support root_dir() function Examples: vim.lsp: Active Clients ~ - lua_ls (id: 1) - Version: <Unknown> - Root directories: ~/foo/bar ~/dev/neovim Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
* fix(lsp): deprecate `vim.lsp.protocol.Methods` (#35998)Maria Solano2025-10-04
|
* docs: json, tests, lsp #35754Justin M. Keyes2025-09-28
| | | | | | | Close #35926 Close #35818 Co-authored-by: skewb1k <skewb1kunix@gmail.com> Co-authored-by: glepnir <glephunter@gmail.com>
* fix(lsp): avoid re-enabling `document_color` on `registerCapability` (#35774)skewb1k2025-09-15
| | | | | | | Problem: The registerCapability handler re-enables document_color, making it impossible to disable it in LspAttach. Solution: Enable it once on initialization and avoid re-enabling on registerCapability.
* docs: manpage, keycodes, jsonJustin M. Keyes2025-09-13
|
* fix(lsp): misleading logs in non-applicable filetypes #35749Justin M. Keyes2025-09-13
| | | | | | | | | | | | | | Problem: LSP logs show misleading "cannot start" messages when editing a filetype NOT listed in the `config.filetypes` field. [ERROR][2025-09-13 18:55:56] …/runtime//lua/vim/lsp/log.lua:151 "cannot start cssls due to config error: …/runtime//lua/vim/lsp.lua:423: cmd: expected expected function or table with executable command, got table: 0x0104701b18. Info: vscode-css-language-server is not executable" Solution: - `can_start`: check `config.filetypes` before checking the rest of the config.
* feat(lsp): support `textDocument/onTypeFormatting` (#34637)Riley Bruins2025-08-31
| | | | | | | | | | Implements [on-type formatting](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.18/specification/#textDocument_onTypeFormatting) using a `vim.on_key()` approach to listen to typed keys. It will listen to keys on the *left hand side* of mappings. The `on_key` callback is cleared when detaching the last on-type formatting client. This feature is disabled by default. Co-authored-by: Maria José Solano <majosolano99@gmail.com>
* refactor(lua): consistent use of local aliasesChristian Clason2025-08-28
|
* feat(lsp): support `textDocument/inlineCompletion`Yi Ming2025-08-25
|
* fix(lsp): deprecate vim.lsp.set_log_level, vim.lsp.get_log_path #35274Maria José Solano2025-08-11
|
* feat(lsp): enable document_color by default #35086Maria José Solano2025-07-27
|
* refactor(lsp): inline `on_client_exit`Yi Ming2025-07-20
|
* refactor(lsp): track clients in `all_clients` once initializedYi Ming2025-07-20
|
* refactor(lsp): extract `Client._on_detach` to reduce duplicated codeYi Ming2025-07-20
|
* feat(lsp): support linked editing ranges #34388Riley Bruins2025-07-19
| | | ref: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_linkedEditingRange
* docs: api, pack, events, developJustin M. Keyes2025-07-10
|
* refactor(lsp): stateful data abstraction, vim.lsp.Capability #34639Yi Ming2025-07-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Closes #31453 Solution: Introduce `vim.lsp.Capability`, which may serve as the base class for all LSP features that require caching data. it - was created if there is at least one client that supports the specific method; - was destroyed if all clients that support the method were detached. - Apply the refactor for `folding_range.lua` and `semantic_tokens.lua`. - Show active features in :checkhealth. Future: I found that these features that are expected to be refactored by `vim.lsp.Capability` have one characteristic in common: they all send LSP requests once the document is modified. The following code is different, but they are all for this purpose. - semantic tokens: https://github.com/neovim/neovim/blob/fb8dba413f2bcaa61c15d1854b28112e3e91a035/runtime/lua/vim/lsp/semantic_tokens.lua#L192-L198 - inlay hints, folding ranges, document color https://github.com/neovim/neovim/blob/fb8dba413f2bcaa61c15d1854b28112e3e91a035/runtime/lua/vim/lsp/inlay_hint.lua#L250-L266 I think I can sum up this characteristic as the need to keep certain data synchronized with the latest version computed by the server. I believe we can handle this at the `vim.lsp.Capability` level, and I think it will be very useful. Therefore, my next step is to implement LSP request sending and data synchronization on `vim.lsp.Capability`, rather than limiting it to the current create/destroy data approach.
* fix(lsp): include context for each client in multi-handler results (#34669)Maria José Solano2025-06-26
|
* fix(lsp) type annotation for `vim.lsp.Config.cmd` #34574Oskar Haarklou Veileborg2025-06-19
| | | | The type annotation for `vim.lsp.ClientConfig.cmd` was changed, but the update was not propagated to `vim.lsp.Config`.
* docs: vim.fs., diagnostics, lsp #34402Justin M. Keyes2025-06-13
|
* fix(lsp): _cancel_all_requests() tries to cancel completed requests #34105Andre Toerien2025-06-12
| | | | | | | | | | Problem: The cancel function returned by `vim.lsp.buf_request` tries to cancel all the requests, including those that have already been completed, causing "Cannot find request with id ... whilst attempting to cancel" errors to be logged when it is called. Solution: Only cancel the requests that are present in `client.requests`.
* feat(vim.fs): root() can specify "equal priority" #34276Siddhant Agarwal2025-06-09
|
* fix: type fixesLewis Russell2025-06-06
| | | | Type fixes caught by emmylua
* fix(lsp): only auto-detach lsp.config enabled clients #34325Kai-Hsiang Hsu2025-06-06
| | | | | | | Problem: A custom server (initialized through `vim.lsp.start`) gets unexpectedly detached. Solution: Only auto-detach the clients enabled through `vim.lsp.enable` to prevent unexpected behavior.
* docs: news, intro, lsp, api #33687Justin M. Keyes2025-06-01
|
* fix(lua): vim.validate `message` param #33675Justin M. Keyes2025-05-04
| | | | | | | Problem: vim.validate does not handle `message` param. Solution: Add the missing logic.
* fix(lsp): check if client is stopping before reuse #33796Eike2025-05-04
| | | | | | | Problem: Stopping a language server and then calling vim.lsp.start() with the same name/root will return the old language server that's in the middle of shutting down. vim.lsp.start() won't return a new server until the old process has terminated. Solution: Introducing a client._is_stopping field that tracks the shutdown phase, preventing the client from being reused.
* fix(lsp): only auto-detach lsp.config clients #33834glepnir2025-05-04
| | | | | | | | Problem: enable() routine detaches clients even if they were manually started and not managed by vim.lsp.config. Solution: Skip clients that aren't managed by vim.lsp.config.
* feat(lsp): detach LSP clients when 'filetype' changes #33707Jeremy Fleischman2025-05-03
| | | | | | | | | | | Problem: When the buffer 'filetype' changes, invalid or non-applicable LSP clients are not detached. https://github.com/neovim/neovim/issues/33443 https://github.com/neovim/nvim-lspconfig/issues/3326 Solution: In the enable() routine, check can_start() on _existing_ clients.
* feat(lsp): vim.lsp.is_enabled() #33703Jeremy Fleischman2025-05-03
| | | | | | | | | Problem: No way to check if a LSP config is enabled without causing it to resolve. E.g. `vim.lsp.config['…'] ~= nil` will resolve the config, which could be an unwanted and somewhat expensive side-effect. Solution: Introduce `vim.lsp.is_enabled()`.
* fix(vim.lsp.enable): don't eagerly enable LSP configs during startup #33762Phạm Bình An2025-05-02
| | | closes #33761
* feat(lsp): start/stop LSPs as necessary during vim.lsp.enable() #33702Jeremy Fleischman2025-04-30
| | | | | | | | | | Problem: enable() could be more flexible, so that it works even if called "late". Solution: - enable(true) calls `doautoall nvim.lsp.enable FileType`. - enable(false) calls `client:stop()` on matching clients. This will be useful for e.g. :LspStop/:LspStart also.
* feat(lsp): `root_markers` can control priority #33485Lorenzo Bellina2025-04-30
| | | | | | | | | | | | | | | | | | Problem: root_markers cannot specify "equal priority filenames. Solution: Support nesting: { ... root_markers = { { ".stylua.toml", ".luarc.json" }, { ".git "} } ... } Co-authored-by: Maria José Solano <majosolano99@gmail.com> Co-authored-by: Gregory Anders <github@gpanders.com> Co-authored-by: Justin M. Keyes <justinkz@gmail.com>