summaryrefslogtreecommitdiffstatshomepage
path: root/test/functional/plugin/lsp/diagnostic_spec.lua
AgeCommit message (Collapse)AuthorFiles
2026-04-15refactor: update usages of deprecated "buffer" param #39089Justin M. Keyes1
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-03-19refactor(lsp): replace _provider_value_get with _provider_foreachtris2031
Introduce _provider_foreach to iterate over all matching provider capabilities for a given LSP method, handling both static and dynamic registrations. Update diagnostic logic and tests to use the new iteration approach, simplifying capability access and improving consistency across features.
2026-02-26fix(lps): separate namespaces for pull/push diagnostics #37938Riccardo Mazzarini1
Problem: Regression from b99cdd0: Pull diagnostics (from `textDocument/diagnostic`) and push diagnostics (from `textDocument/publishDiagnostics`) use the same namespace, which is a problem when using language servers that publish two different sets of diagnostics on push vs pull, like rust-analyzer (see https://github.com/rust-lang/rust-analyzer/issues/18709#issuecomment-2551394047). Solution: Rename `is_pull` to `pull_id` which accepts a pull namespace instead of just a boolean.
2026-02-14refactor(lsp): centralize provider capability resolution #37221Tristan Knight1
- Refactor LSP client to use unified provider-based capability lookup for diagnostics and other features. - Introduce `_provider_value_get` to abstract capability retrieval, supporting both static and dynamic registrations. - Update diagnostic handling and protocol mappings to leverage provider-centric logic.
2026-02-08test(lsp/diagnostic): clearing diagnostics #37759GenchoXD1
Problem: Diagnostic lifecycle invariants (clearing on empty publish and buffer deletion) were previously implicit and not directly covered by functional tests, allowing regressions to go unnoticed. Solution: Add functional regression tests asserting that diagnostics are cleared when an LSP server publishes an empty diagnostic set and when the associated buffer is deleted. Assertions are scoped to the client diagnostic namespace and use public diagnostic APIs only.
2026-01-15test(lsp/diagnostic_spec): fix creating unused clients (#37397)zeertzjq1
Fix #36793 Also fix some `integer?` -> `integer` conversion warnings while at it.
2025-12-09Revert "feat(lsp): support `version` in `textDocument/publishDiagnostics` ↵Mathias Fußenegger1
#36754" (#36865) This reverts commit 03d6cf7aae4a72c7221a4fb8ebb14a7c8603ba18. See https://github.com/neovim/neovim/pull/36754#issuecomment-3626115697 The change was supposed to avoid showing stale diagnostics but had the opposite effect.
2025-12-06feat(lsp): support dynamic registration for diagnostics (#36841)Tristan Knight1
2025-12-05refactor(lsp): fix lintPig Fang1
2025-12-05test(lsp): accept callback for diagnosticPig Fang1
2025-12-05refactor(lsp): fix lintPig Fang1
2025-12-05feat(lsp): support refreshing workspace diagnosticsPig Fang1
2025-12-05test(lsp): polish tests of refreshing diagnosticsPig Fang1
2025-12-05test(lsp): update test namePig Fang1
2025-12-05feat(lsp): support diagnostic refresh requestPig Fang1
2025-11-29feat(lsp): support `version` in `textDocument/publishDiagnostics` #36754Riley Bruins1
This commit makes it so that push diagnostics received for an outdated document version are ignored.
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-10-04fix(lsp): deprecate `vim.lsp.protocol.Methods` (#35998)Maria Solano1
2025-09-24test: don't call clear() in both before_each() and after_each() (#35901)zeertzjq1
2025-07-21feat(lsp): diagnostic related documents supportRiley Bruins1
2025-07-21fix(lsp): store result id for unchanged diagnostic reportsRiley Bruins1
**Problem:** For unchanged document diagnostic reports, the `resultId` is ignored completely, even though it should still be saved for the request (in fact, the spec marks it as mandatory for unchanged reports, so it should be extra important). **Solution:** Always store the `resultId`.
2025-05-03fix(lsp): improper diagnostic end_col computationRiley Bruins1
**Problem:** For multiline diagnostics, the end column was improperly calculated by checking the byte index of the character position on the *start* line. **Solution:** Calculate the byte index for end_col using the *end* line.
2025-04-26perf(lsp): include `previousResultId` in `DocumentDiagnosticParams` #32887Yi Ming1
Problem: Users of the Roslyn (C#) LSP have encountered significant delays when retrieving pull diagnostics in large documents while using Neovim. For instance, diagnostics in a 2000-line .cs file can take over 20 seconds to display after edits in Neovim, whereas in VS Code, diagnostics for the same file are displayed almost instantly. As [mparq noted](https://github.com/seblj/roslyn.nvim/issues/93#issuecomment-2508940330) in https://github.com/seblj/roslyn.nvim/issues/93, VS Code leverages additional parameters specified in the [LSP documentation for textDocument/diagnostic](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#documentDiagnosticParams), specifically: - previousResultId - identifier Solution: When requesting diagnostics, Neovim should include the `previousResultId` and `identifier` parameters as part of the request. These parameters enable the server to utilize caching and return incremental results. Support for maintaining state is already present in the [textDocument/semanticTokens implementation](https://github.com/neovim/neovim/blob/8f84167c30692555d3332565605e8a625aebc43c/runtime/lua/vim/lsp/semantic_tokens.lua#L289). A similar mechanism can be implemented in `textDocument/diagnostic` handler.
2024-12-04feat(lsp): deprecate vim.lsp.start_client #31341Maria José Solano1
Problem: LSP module has multiple "start" interfaces. Solution: - Enhance vim.lsp.start - Deprecate vim.lsp.start_client
2024-11-25fix(lsp): retrigger diagnostics request on server cancellation (#31345)Gregory Anders1
Co-authored-by: Jesse <github@jessebakker.com>
2024-11-01feat(lsp)!: remove client-server handlers from vim.lsp.handlersLewis Russell1
- Partition the handlers in vim.lsp.handlers as: - client to server response handlers (RCS) - server to client request handlers (RSC) - server to client notification handlers (NSC) Note use string indexes instead of protocol.methods for improved typing in LuaLS (tip: use hover on RCS, RSC or NSC).
2024-10-26refactor(lsp): drop str_byteindex/str_utfindex wrappers #30915Tristan Knight1
* deprecate old signatures * move to new str_byteindex/str_utfindex signature * use single-underscore name (double-underscore is reserved for Lua itself)
2024-09-21test: support upvalues in exec_luaLewis Russell1
2024-08-02refactor(lsp): add test case for default diagnostic severityMathias Fussenegger1
See https://github.com/microsoft/language-server-protocol/pull/1978 If the severity is not specified by the server, error should be used. This was already the case because it matches the vim.diagnostic default. This only adds a test case for it.
2024-08-01fix(lsp): don't send foreign diagnostics to servers in buf.code_action (#29501)Mathias Fußenegger1
`buf.code_action` always included diagnostics on a given line from all clients. Servers should only receive diagnostics they published, and in the exact same format they sent it. Should fix https://github.com/neovim/neovim/issues/29500
2024-04-23test: improve test conventionsdundargoc1
Specifically, functions that are run in the context of the test runner are put in module `test/testutil.lua` while the functions that are run in the context of the test session are put in `test/functional/testnvim.lua`. Closes https://github.com/neovim/neovim/issues/27004.
2024-04-10refactor(test): inject after_each differentlyLewis Russell1
2024-04-08test: improve test conventionsdundargoc1
Work on https://github.com/neovim/neovim/issues/27004.
2024-03-11test: correct order of arguments to eq() (#27816)zeertzjq1
2024-02-08feat(lsp): deprecate severity_limitLewis Russell1
Problem: `vim.lsp.diagnostic.on_diagnostic` accepts an undocumented severity_limit option which is widely used. Solution: Deprecate it in favour of `{min = severity}` used in `vim.diagnostic`. Since this is undocumented, the schedule for removal is accelerated to 0.11.
2024-01-03refactor: format test/*Justin M. Keyes1
2023-08-31fix(lsp): only disable inlay hints / diagnostics if no other clients are ↵Chris AtLee1
connected (#24535) This fixes the issue where the LspNotify handlers for inlay_hint / diagnostics would end up refreshing all attached clients. The handler would call util._refresh, which called vim.lsp.buf_request, which calls the method on all attached clients. Now util._refresh takes an optional client_id parameter, which is used to specify a specific client to update. This commit also fixes util._refresh's handling of the `only_visible` flag. Previously if `only_visible` was false, two requests would be made to the server: one for the visible region, and one for the entire file. Co-authored-by: Stanislav Asunkin <1353637+stasjok@users.noreply.github.com> Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com>
2023-07-20feat(lsp): implement textDocument/diagnostic (#24128)Chris AtLee1
2023-03-30feat(diagnostic): add support for tagsLewis Russell1
The LSP spec supports two tags that can be added to diagnostics: unnecessary and deprecated. Extend vim.diagnostic to be able to handle these.
2022-07-17refactor(lsp): use autocmd api (#19407)ii141
* refactor(lsp): use autocmd api * refactor(lsp): inline BufWritePost and VimLeavePre callbacks
2022-04-26fix(lsp): fix unnecessary buffers being added on empty diagnostics (#18275)ii141
Some language servers send empty `textDocument/publishDiagnostics` messages after indexing the project with URIs corresponding to unopened buffers. This commit guards against opening buffers corresponding to empty diagnostics.
2022-03-02feat(diagnostic): add "code" to the diagnostic structure (#17510)David Shen1
2021-10-29refactor(diagnostic): make display handlers generic (#16137)Gregory Anders1
Rather than treating virtual_text, signs, and underline specially, introduce the concept of generic "handlers", of which those three are simply the defaults bundled with Nvim. Handlers are called in `vim.diagnostic.show()` and `vim.diagnostic.hide()` and are used to handle how diagnostics are displayed.
2021-09-21fix(diagnostic): preserve fields from LSP diagnostics via user_data (#15735)Gregory Anders1
* preserve fields from LSP diagnostics via adding a user_data table to the diagnostic, which can hold arbitrary data in addition to the lsp diagnostic information.
2021-09-17fix(diagnostic): remove useless highlight links (#15683)Gregory Anders1
These links were actually defined backwards: the highlight groups actually being used for display are the new "Diagnostic*" groups, so linking the old "LspDiagnostics*" groups to these does absolutely nothing, since there is nothing actually being highlighted with the LspDiagnostics* groups. These links were made in an attempt to preserve backward compatibility with existing colorschemes. We could reverse the links to maintain this preservation, but then that disallows us from actually defining default values for the new highlight groups. Instead, just remove the links and be done with the old LspDiagnostics* highlight groups. This is not technically a breaking change: the breaking change already happened in #15585, but this PR just makes that explicit.
2021-09-16fix(lint): remove unused function from diagnostic specGregory Anders1
2021-09-15refactor: move vim.lsp.diagnostic to vim.diagnosticGregory Anders1
This generalizes diagnostic handling outside of just the scope of LSP. LSP clients are now a specific case of a diagnostic producer, but the diagnostic subsystem is decoupled from the LSP subsystem (or will be, eventually). More discussion at [1]. [1]: https://github.com/neovim/neovim/pull/15585
2021-09-05feat(lsp)!: change handler signatureMichael Lingelbach1
Previously, the handler signature was: function(err, method, params, client_id, bufnr, config) In order to better support external plugins that wish to extend the protocol, there is other information which would be advantageous to forward to the client, such as the original params of the request that generated the callback. In order to do this, we would need to break symmetry of the handlers, to add an additional "params" as the 7th argument. Instead, this PR changes the signature of the handlers to: function(err, result, ctx, config) where ctx (the context) includes params, client_id, and bufnr. This also leaves flexibility for future use-cases. BREAKING_CHANGE: changes the signature of the built-in client handlers, requiring updating handler calls
2021-07-19feat(lsp): allow diagnostics to be disabled for a buffer (#15134)Gregory Anders1
Add two new methods to allow diagnostics to be disabled (and re-enabled) in the current buffer. When diagnostics are disabled they are simply not displayed to the user, but they are still sent by the server and processed by the client. Disabling diagnostics can be helpful in a number of scenarios. For example, if one is working on a buffer with an overwhelming amount of diagnostic warnings it can be helpful to simply disable diagnostics without disabling the LSP client entirely. This also allows users more flexibility on when and how they may want diagnostic information to be displayed. For example, some users may not want to display diagnostic information until after the buffer is first written.