summaryrefslogtreecommitdiffstatshomepage
path: root/runtime/lua/vim/lsp/buf.lua
AgeCommit message (Collapse)AuthorFiles
2026-04-23fix(lsp): filter code_action diagnostics to the cursor #38988Barrett Ruth1
Problem: Cursor-position `vim.lsp.buf.code_action()` requests include all diagnostics on the current line, so unrelated same-line diagnostics affect the returned actions. Solution: Filter same-line diagnostics to the cursor position for cursor-position requests.
2026-04-19docs(lsp): description for `on_list` example #39230Maria Solano1
2026-04-16refactor(lsp): provide a default list handler example #39005Yi Ming1
Problem: Difficult for us to provide default handlers for functions like `vim.lsp.buf.definition`. When users wanted to fine-tune the default behavior, they don't know how. Solution: - Document an example providing `on_list` boilerplate to make it easier for users to modify and override. - Also, considering that the parameters of the previous `on_list`(`vim.lsp.ListOpts.OnList`) are compatible with the parameters of `setqflist`, remove that custom type in favor of passing `vim.fn.setqflist.what`.
2026-04-11fix(lsp): check stale context in hover/signature callback #38724glepnir1
Problem: hover/signature callback lacked consistency checks, so slow LSP servers could open a float after the cursor had already moved away. Solution: guard the callback with buf validity, buf version, and cursor position checks before opening the float. Also fix table capacity calculation.
2026-04-09refactor(lsp): share code by `get_locations` #38902Yi Ming1
Problem: `vim.lsp.buf.definition`/`vim.lsp.buf.declaration` use the same underlying code via `get_locations`, whereas `vim.lsp.buf.reference` does not. This is because `buf.reference` does not perform a jump when there is only one item. Solution: In #38510, I simplified the jump logic using `:cfirst`, so they can now share code more easily. Additionally, this PR enables `buf.definition` to display the corresponding qflist name.
2026-04-08fix(diagnostics)!: restore `is_pull` namespace argument #38698Maria Solano1
Problem: The current LSP diagnostic implementation can't differ between a pull diagnostic with no identifier and a set of diagnostics provided via push diagnostics. "Anonymous pull providers" are expected by the protocol https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#diagnosticOptions , depending on how the capability was registered: - Dynamic registrations have an identifier. - Static registrations will not. Solution: Restore the `is_pull` argument removed in https://github.com/neovim/neovim/pull/37938, keeping the identifier of pull diagnostic collections.
2026-04-02refactor(lsp): remove implicit rpc error tostring #38707Yi Ming1
Problem: LSP error responses implicitly rely on a custom `__tostring` function (`vim.lsp.rpc.format_rpc_error`) for formatting. This causes errors that are not created via `vim.lsp.rpc.error` to behave inconsistently with those that are. Furthermore, we usually use `log.error` to print these errors, which uses `vim.inspect` under the hood, so the custom `__tostring` provides little benefit. This increases the difficulty of refactoring the code, as it tightly couples RPC error handling with the LSP. Solution: Convert every potential `__tostring` call to an explicit one. Since we don't describe this behavior in the documentation, this should not be a breaking change.
2026-03-30feat(lsp): respect 'switchbuf' for jump commands, drop `reuse_win` #38510Yi Ming1
Problem: LSP jump operations such as `buf.definition`/`buf.type_definition` do not follow the 'switchbuf' option. Instead their behavior is controlled by `vim.lsp.LocationOpts.reuse_win`. When `reuse_win=true`, the effect is very similar to `set switchbuf=useopen`. Note that functions like `buf.definition` open the quickfix window when there are multiple results, and jumping between quickfix entries already follows 'switchbuf', so unifying the behavior is more intuitive. Solution: Follow the 'switchbuf' option and drop `reuse_win`. We can achieve this behavior by using :cfirst when the quickfix list has only one item, rather than customizing the jump logic as before.
2026-03-23fix(lsp): get_namespace signature (#38449)Tristan Knight1
Problem: Since the change to `pull_id` in #37938 we used the deprecated signature internally Solution: Don't
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-21fix(lsp/diagnostic): use diagnostic provider identifier for code actions #38401Sergei Slipchenko1
Problem: f9b2189b287a14478546da72b7ecdfd3afe981c7 started using namespaces for pull diagnostics that look like this `<id>:<identifier>`. `vim.lsp.buf.codeaction` passes `true` instead of an identifier to `vim.lsp.diagnostic.get_namespace`, resulting in a namespace that looks like `<id>:nil`. The end result is that none of the diagnostics are passed to `textDocument/codeAction` request. Because of that server might not send any code actions back. For example, eslint lsp responds with an empty list of actions if it receives no diagnostics. Solution: use `_provider_foreach` to collect diagnostics from all `identifiers` and use that identifier to get a namespace instead of `true`.
2026-03-19fix(lsp): improve diagnostics handling and commentstris2031
- Add TODO comments for aggregating diagnostics from all pull namespaces and for clearing diagnostics when an empty array is received, referencing the LSP specification. - Update diagnostics refresh logic to safely access previousResultId, preventing potential nil errors.
2026-02-01fix(lsp): call `on_list` before reading `loclist` #37645Maria Solano1
Problem: `on_list` is supposed to replace the default list-handler. With the current order of these `if` statements `on_list` won't be called if `loclist` is true. Solution: Change the order of the relevant blocks.
2026-01-23feat(lsp): highlighting the symbol being renamed (#37390)Yi Ming1
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-07docs: misc (#37280)zeertzjq1
Close #36806 Close #36812 Close #37003 Close #37016 Close #37038 Close #37039 Close #37157 Close #37185 Close #37213 Co-authored-by: saroj_r <sarojregmi.official@gmail.com> Co-authored-by: Olivia Kinnear <git@superatomic.dev> Co-authored-by: Igor <igorlfs@ufmg.br> Co-authored-by: Justin Roberts <JustinEdwardLeo@gmail.com> Co-authored-by: "Mike J. McGuirk" <mike.j.mcguirk@gmail.com> Co-authored-by: Aymen Hafeez <49293546+aymenhafeez@users.noreply.github.com> Co-authored-by: Peter Cardenas <16930781+PeterCardenas@users.noreply.github.com> Co-authored-by: DrNayak2306 <dhruvgnk.work@gmail.com>
2025-11-24feat(lsp): incremental-selection operator-pending mode #36575Branden Call1
Problem: LSP incremental selection provides default visual-mode keymaps for `an` and `in`. Operator-pending mode is not supported, so `dan` and `can` do not apply the operation. Solution: Modify selection_range() to be synchronous. Add operator-pending mappings.
2025-11-12fix(lsp): reuse_win prioritizes windows/tabs currently displayed #36486Toby She1
Problem: reuse_win will always jump to the first window containing the target buffer rather even if the buffer is displayed in the current window/tab Solution: check to see if the buffer is already displayed in the current window or any window of the current buffer
2025-10-05feat(lsp): pass client ID in code action filter (#36046)Maria Solano1
2025-10-04fix(lsp): deprecate `vim.lsp.protocol.Methods` (#35998)Maria Solano1
2025-09-16docs: small fixes (#35791)zeertzjq1
Close #34938 Close #35030 Close #35233 Close #35259 Close #35290 Close #35433 Close #35541 Close #35766 Close #35792 Co-authored-by: huylg <45591413+huylg@users.noreply.github.com> Co-authored-by: Jason Del Ponte <961963+jasdel@users.noreply.github.com> Co-authored-by: sooriya <74165167+thuvasooriya@users.noreply.github.com> Co-authored-by: Andrew Braxton <andrewcbraxton@gmail.com> Co-authored-by: Enric Calabuig <enric.calabuig@gmail.com> Co-authored-by: Augusto César Dias <augusto.c.dias@gmail.com> Co-authored-by: David Sierra DiazGranados <davidsierradz@gmail.com> Co-authored-by: Stepan Nikitin <90522882+vectravox@users.noreply.github.com> Co-authored-by: Emilien Breton <bricktech2000@gmail.com>
2025-08-28refactor(lua): consistent use of local aliasesChristian Clason1
2025-08-27fix(lsp): don't treat MarkedString[] with language id as empty #35518Robert Muir1
Problem: Hover response of MarkedString[] where the first element contains a language identifier treated as empty. Solution: Fix empty check to handle case of MarkedString[] where the first element is a pair of a language and value.
2025-08-21fix(lsp): handle array with empty string when checking empty hover (#35423)Igor Lacerda1
2025-08-20fix(lsp): update window title when cycling through signatures #35407Tiago Inaba1
2025-08-11feat(lsp): support signature help noActiveParameterSupport #34838skewb1k1
2025-08-11docs(lsp): specify formatting_options type (#35302)Riley Bruins1
2025-08-06feat(lsp): improve signature help display #35190skewb1k1
- Add delimiter between function signature and documentation, matching hover formatting - Show title only if there are multiple clients or multiple signatures - Avoid duplicating the title inside the window if it's already shown in the border
2025-08-03revert(lsp): compare to `vim.NIL` in `lsp/buf.lua` (#35156)Maria José Solano1
revert(lsp): "compare to `vim.NIL` in `lsp/buf.lua` #35154" This reverts commit a5c598871bcc16f1bc6fb8d46eb826d83d7d0f24.
2025-08-03fix(lsp): compare to `vim.NIL` in `lsp/buf.lua` #35154Maria José Solano1
2025-08-02fix(lsp): handle nil response in references request #35139Maria José Solano1
2025-07-26fix(lsp): don't override `config.title` in `vim.lsp.buf.signature_help()` #35075Maria José Solano1
2025-07-20fix(lsp): show notification with empty hover response (#35014)Maria José Solano1
2025-07-06refactor(lsp): narrower `hierarchy` argument type (#34799)Maria José Solano1
2025-07-06refactor(lsp): consistent usage of vim.notify #34802Maria José Solano1
2025-07-04fix(lsp): consistent use of `vim.notify`/logging with unsupported methodsMaria José Solano1
2025-07-04fix(lsp): remove extra notify on empty hoverMaria José Solano1
2025-06-26fix(lsp): include context for each client in multi-handler results (#34669)Maria José Solano1
2025-06-23refactor(lsp): use `vim.lsp.buf_request_all` internally (#34604)Maria José Solano1
2025-06-17fix(lsp): support v:count in selection_range() #34551Riley Bruins1
Co-authored-by: Yi Ming <ofseed@foxmail.com>
2025-06-16feat(lsp): handle disabled code actions (#34453)Riley Bruins1
This commit also makes it so that disabled code actions are not displayed unless the trigger kind is "Invoked".
2025-06-16fix(lsp): add missing argument validations (#34519)Maria José Solano1
2025-06-15fix(lsp): use correct deprecation function (#34518)Maria José Solano1
2025-06-12feat(lsp): <Plug> mapping for signature help cycling #34039Tiago Inaba1
Replace direct function mappings with `<Plug>` mappings for cycling through overloaded signatures, providing better customization options for users. This change keeps the default mapping (`<C-s>`) for cycling if `<Plug>(nvim.lsp.ctrl-s)` is not mapped.
2025-06-12feat(lsp): incremental selection via "textDocument/selectionRange" #34011Riley Bruins1
Select outwards with "an" and inwards with "in" in Visual mode. Ranges are reset when leaving Visual mode.
2025-06-09feat(lsp): workspace diagnostic support (#34262)Maria José Solano1
* refactor(lsp): remove underscore prefix from local variables * feat(lsp): workspace diagnostic support
2025-06-06fix: type fixesLewis Russell1
Type fixes caught by emmylua
2025-04-27docs: lsp, emoji, startup #33446Justin M. Keyes1
Co-authored-by: Maria José Solano <majosolano99@gmail.com>
2025-04-26fix(lsp): cycling signatures with the default `config.focusable`Yi Ming1
2025-04-26fix(lsp): prioritize showing active signatureYi Ming1