summaryrefslogtreecommitdiffstatshomepage
path: root/runtime/lua/vim/lsp.lua
AgeCommit message (Collapse)AuthorFiles
2026-04-15feat(lsp): highlight foldtext via treesitter #38789Yi Ming1
Problem: To support `collapsedText`, which allows the LSP server to determine the content of the foldtext, we provided `vim.lsp.foldtext()`. However, such content does not have highlighting. Solution Treat the filetype of `collapsedText` as the filetype of the corresponding buffer and use tree-sitter to highlight it.
2026-04-14docs: lsp, options, api #38980Justin M. Keyes1
docs: lsp, options - revert bogus change to `_meta/builtin_types.lua` from 3a4a66017b74 Close #38991 Co-authored-by: David Mejorado <david.mejorado@gmail.com>
2026-04-12revert: "fix(lsp): only resolve LSP configs once" #38990Justin M. Keyes1
revert eb90f5d9e3a6615870f9bf0b28e30f6e84ccd6f4
2026-04-12fix(lsp): send didOpen on save to all clients+groups #37454Emilv21
Problem: _get_and_set_name edits the name for the whole group, thus only one client per group gets the didOpen message. Solution: move the logic to _changetracking and loop over every client per group.
2026-04-08feat(api): rename buffer to buf #35330Jordan1
Problem: `:help dev-name-common` states that "buf" should be used instead of "buffer" but there are cases where buffer is mentioned in the lua API. Solution: - Rename occurrences of "buffer" to "buf" for consistency with the documentation. - Support (but deprecate) "buffer" for backwards compatibility. Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2026-04-01Merge #38560 refactor vim.lsp.rpcJustin M. Keyes1
2026-03-30docs: fix syntax errors in examples #38606skewb1k1
2026-03-30refactor(lsp): merge `vim.lsp.rpc.Client` and `vim.lsp.rpc.PublicClient`Yi Ming1
2026-03-24test(lsp): get_configs resolves only necessary configsJustin M. Keyes1
2026-03-24docs: api, plugins, ui2Justin M. Keyes1
2026-03-23feat(lsp): attach to buftype=help buffers #38412Barrett Ruth1
Problem: `vim.lsp.enable()` skips all buffers with non-empty `buftype`, including `help` buffers. LSPs targeting `filetype='help'` never auto-attach despite help buffers being real files. Solution: Expand the `buftype` guard in `lsp_enable_callback` to allow `help` alongside `""`.
2026-03-22revert: "feat(lsp): add `buftypes` field to `vim.lsp.Config`" #38421Maria Solano1
revert: "feat(lsp): add `buftypes` field to `vim.lsp.Config` (#38380)" This reverts commit cfcdbcf638b5957213b3c1a55d5d1b5659a2fb3e.
2026-03-21feat(lsp): add `buftypes` field to `vim.lsp.Config` (#38380)Barrett Ruth1
Problem: `vim.lsp.enable()` skips buffers with `buftype` set, even when `filetype` matches. Solution: Add `buftypes` field to `vim.lsp.Config`.
2026-03-21feat(lua): replace `buffer` with `buf` in vim.keymap.set/del #38360skewb1k1
The `buffer` option remains functional but is now undocumented. Providing both will raise an error. Since providing `buf` was disallowed before, there is no code that will break due to using `buffer` alongside `buf`.
2026-03-20docs: miscJustin M. Keyes1
2026-03-20feat(stdlib): vim.fs.ext() returns file extension #36997Yochem van Rosmalen1
Problem: Checking the extension of a file is done often, e.g. in Nvim's codebase for differentiating Lua and Vimscript files in the runtime. The current way to do this in Lua is (1) a Lua pattern match, which has pitfalls such as not considering filenames starting with a dot, or (2) fnamemodify() which is both hard to discover and hard to use / read if not very familiar with the possible modifiers. vim.fs.ext() returns the file extension including the leading dot of the extension. Similar to the "file extension" implementation of many other stdlibs (including fnamemodify(file, ":e")), a leading dot doesn't indicate the start of the extension. E.g.: the .git folder in a repository doesn't have the extension .git, but it simply has no extension, similar to a folder named git or any other filename without dot(s).
2026-03-19feat(lsp): vim.lsp.get_configs() #37237Olivia Kinnear1
Problem: No way to iterate configs. Users need to reach for `vim.lsp.config._configs`, an internal interface. Solution: Provide vim.lsp.get_configs(). Also indirectly improves :lsp enable/disable completion by discarding invalid configs from completion.
2026-03-18docs: misc, terminalJustin M. Keyes1
Close #38319 Close #38348 Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Barrett Ruth <br.barrettruth@gmail.com>
2026-03-12refactor: integer functions, optimize asserts #34112Lewis Russell1
refactor(lua): add integer coercion helpers Add vim._tointeger() and vim._ensure_integer(), including optional base support, and switch integer-only tonumber()/assert call sites in the Lua runtime to use them. This also cleans up related integer parsing in LSP, health, loader, URI, tohtml, and Treesitter code. supported by AI
2026-03-12docs: use "ev" convention in event-handlersJustin M. Keyes1
Problem: In autocmd examples, using "args" as the event-object name is vague and may be confused with a user-command. Solution: Use "ev" as the conventional event-object name.
2026-03-11docs: api, messages, lsp, trustJustin M. Keyes1
gen_vimdoc.lua: In prepare for the upcoming release, comment-out the "Experimental" warning for prerelease features.
2026-02-23fix(lsp): only resolve LSP configs once (#38007)Andrew Braxton1
`lsp.config[]` resolves an LSP config the first time it is called, and returns the cached result on subsequent calls. The change in #37571 added an extra call to `lsp.config[]` which will resolve the config *before* the server is added to `_enabled_configs`, meaning the result is discarded. That means configs will be needlessly resolved again once `lsp_enable_callback` fires for the first time. That includes an additional `loadfile()` call which is relatively expensive and can have unexpected side effects. Avoid this by storing the result of the initial call to `lsp.config[]` in `_enabled_configs` so the config is not resolved a second time once `lsp_enable_callback` is called for the first time.
2026-02-23refactor: defer_fn return type #37999Justin M. Keyes1
2026-02-18fix(lsp): add `vim.deprecate` call to `vim.lsp.with` (#37960)Maria Solano1
2026-02-18fix(lsp): wait to display exit message #37925Olivia Kinnear1
2026-02-15fix(lsp): wait for exit_timeout on quit #37597phanium1
Problem: When quitting Nvim, LSP servers will not be force-stopped, even if ClientConfig.exit_timeout is set to an integer. pkill emmylua_ls; VIMRUNTIME=runtime/ nvim --clean -u repro.lua repro.lua ; waitpid $(pgrep emmylua_ls) vim.lsp.config('foo', { cmd = { 'emmylua_ls' }, exit_timeout = 1000 }) vim.lsp.enable('foo') vim.defer_fn(vim.cmd.quit, 500) Solution: On VimExit, wait up to `exit_timeout:integer` milliseconds for servers to exit. Do this with an explicit `vim.wait()`, because the actual force-stop is deferred, and won't be attempted if Nvim exits before then. Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2026-02-12docs: lsp, options, promptbufJustin M. Keyes1
Close #37630 Close #37682 Close #37762 Close #37785 Co-authored-by: Daniel Schmitt <d.schmitt@lansoftware.de> Co-authored-by: Duane Hilton <duane9@gmail.com> Co-authored-by: NeOzay <colpaert.benoit@gmail.com> Co-authored-by: Yi Ming <ofseed@foxmail.com> Co-authored-by: "Justin M. Keyes" <justinkz@gmail.com>
2026-02-12refactor(lsp): drop once(), use _memoize() #37829Justin M. Keyes1
2026-01-27fix: lsp.enable() don't work correctly inside FileType event #37538phanium1
Problem: Two cases lsp.enable() won't work in the first FileType event 1. lsp.enable luals inside FileType or ftplugin/lua.lua, then: ``` nvim a.lua ``` 2. lsp.enable luals inside FileType or ftplugin/lua.lua, then: ``` nvim -> :edit a.lua -> :mksession! | restart +qa! so Session.vim ``` Solution: Currently `v:vim_did_enter` is used to detected two cases: 1. "maunally enabled" (lsp.enable() or `:lsp enable`) 2. "inside FileType event" To detect 2. correctly we use did_filetype().
2026-01-27fix(lsp): remove side-effects if `vim.lsp.enable()` raises an error (#37571)Olivia Kinnear1
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.
2026-01-22fix(lsp): raise error when lsp config is invalid type (#37508)Olivia Kinnear1
2026-01-12docs: misc (#37281)zeertzjq1
Close #37289 Close #37348 Co-authored-by: Marc Jakobi <marc@jakobi.dev> Co-authored-by: Anton Kesy <anton@kesy.de>
2026-01-02fix(lsp): improve dynamic registration handling #37161Tristan Knight1
Work on #37166 - Dynamic Registration Tracking via Provider - Supports_Method - Multiple Registrations - RegistrationOptions may dictate support for a method
2025-12-16feat(lsp): builtin :lsp commandbrianhuster1
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>
2025-12-06docs: miscJustin M. Keyes1
fix https://github.com/neovim/neovim.github.io/issues/419 Co-authored-by: Rob Pilling <robpilling@gmail.com>
2025-11-30feat(lsp): graduate ClientConfig `exit_timeout` #36750Olivia Kinnear1
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.
2025-11-29feat(lsp): lsp.enable() auto-escalates forced shutdown #36458Olivia Kinnear1
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`.
2025-11-11fix(lsp): check `nvim.lsp.enable` before `doautoall` #36518Maria Solano1
2025-11-10feat(lsp): deprecate `vim.lsp.stop_client` (#36459)Olivia Kinnear1
* feat(lsp): deprecate `vim.lsp.stop_client` * fix(tests): fix nil variable in diagnostic_spec.lua
2025-11-10fix(lsp): deprecate `vim.lsp.get_buffers_by_client_id` (#36449)Maria Solano1
2025-11-01feat(lsp): support auto-force escalation in client stop (#36378)Maria Solano1
2025-10-24docs: types, news, lua-pluginJustin M. Keyes1
- mention "lua_ls", not "luals". https://github.com/neovim/neovim/discussions/36182 Co-authored-by: Maria Solano <majosolano99@gmail.com>
2025-10-21fix(lsp): noisy log message when enabling server without config #36264Riley Bruins1
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.
2025-10-16fix(lsp): replace `string` types with LSP method alias type annotations ↵David1
where appropriate. (#36180) fix(lsp): replace `string` types with LSP method alias where appropriate
2025-10-14revert "fix(lsp): _get_workspace_folders does not handle root_dir() ↵Mathias Fußenegger1
function" #36183 This reverts commit 97ab24b9c7d9327740f0692f8076fed5737a52dc. See discussion in https://github.com/neovim/neovim/pull/36071
2025-10-15fix(lsp): "attempt to index nil config" #36189Justin M. Keyes1
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.
2025-10-11fix(lsp): _get_workspace_folders does not handle root_dir() function #36071atusy1
* 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>
2025-10-04fix(lsp): deprecate `vim.lsp.protocol.Methods` (#35998)Maria Solano1
2025-09-28docs: json, tests, lsp #35754Justin M. Keyes1
Close #35926 Close #35818 Co-authored-by: skewb1k <skewb1kunix@gmail.com> Co-authored-by: glepnir <glephunter@gmail.com>
2025-09-15fix(lsp): avoid re-enabling `document_color` on `registerCapability` (#35774)skewb1k1
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.