summaryrefslogtreecommitdiffstatshomepage
path: root/runtime/lua/vim/lsp/diagnostic.lua
AgeCommit message (Collapse)AuthorFiles
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-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-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-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-03-19fix(lsp/diagnostic): key resultId by client and identifiertris2031
Previously, resultId for diagnostics was keyed only by client_id, which could cause issues when multiple identifiers are used by the same client. This change introduces a composite key of client_id and identifier for client_result_id, ensuring correct tracking of diagnostic results per identifier. Updates all relevant logic to use the new keying scheme.
2026-03-19fix(lsp): request diagnostics from all registrationstris2031
Update diagnostic refresh to request diagnostics from all provider registrations using _provider_foreach. This ensures diagnostics are fetched from every registered provider during a refresh. Co-authored-by: ZieMcd <ziemcd@gmail.com>
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-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-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.
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-08fix(lsp): fix incorrect params because of typo (#36871)Pig Fang1
2025-12-06feat(lsp): support dynamic registration for diagnostics (#36841)Tristan Knight1
2025-12-05refactor(lsp): fix lintPig Fang1
2025-12-05feat(lsp): support refreshing workspace diagnosticsPig Fang1
2025-12-05refactor(lsp): simplify handling diagnostic "on_refresh"Pig 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-10-25fix(lsp): ensure bufnr is passed for buffer-local requests (#36325)skewb1k1
Problem: Some LSP method handlers were making requests without specifying a bufnr, defaulting to 0 (current). This works in most cases but fails when client attaches to background buffers, causing assertions in handlers to fail. Solution: Ensure bufnr is passed to Client.request for buffer-local methods.
2025-10-07fix(lsp): use LSP method type in more places (#36069)Maria Solano1
2025-10-04fix(lsp): deprecate `vim.lsp.protocol.Methods` (#35998)Maria Solano1
2025-09-27fix(lsp): remove `vim.lsp.diagnostic.reset()` (#35938)Maria Solano1
2025-08-28refactor(lua): consistent use of local aliasesChristian Clason1
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-07-10feat(diagnostic): jump to related info location from `open_float` #34837Riley Bruins1
This commit allows users to jump to the location specified in a diagnostic's `relatedInformation`, using `gf` from within the `open_float` window. The cursor need only be on line that displays the related info.
2025-07-07feat(lsp): support diagnostic related information (#34474)Riley Bruins1
2025-06-27fix(lsp): fix workspace diagnostic request to follow spec (#34674)Zie Mcdowell1
* fix(lsp): fix workspace diagnostic request to follow spec * refactor(lsp): add type annotation
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-06-03fix(vim.diagnostic): improve typingLewis Russell1
Problem: `vim.diagnostic.set()` doesn't actually accept a list of `vim.Diagnostic` as internally `vim.diagnostic.set()` normalizes the diagnostics and this normalization is assumed throughout the module. Solution: - Add a new type `vim.Diagnostic.Set` which is the input to `vim.diagnostic.set()` - `col` is now an optional field and defaults to `0` to be consistent with `vim.diagnostic.match()`. - Change `table.insert(t, x)` to `table[#table + 1] = x` for improved type checking.
2025-05-22fix: use nvim namespace convention #34010Yochem van Rosmalen1
2025-05-10refactor(docs): remove unnecessary `@private`/`@nodoc` annotations (#33951)Maria José Solano1
* refactor(docs): remove `@private` annotations from local functions * refactor(docs): remove unnecessary `@nodoc` annotations
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.
2025-03-17fix(diagnostic): remove deprecated `severity_limit` optionChristian Clason1
Deprecated to be removed in 0.11
2025-03-11refactor(lsp): rename `on_publish_diagnostics` parameter #32776Will Lillis1
* fix(lsp): rename `on_publish_diagnostics` parameter: result->params * fix(colors): specify local var type to address lint failure
2025-01-27fix: resolve all remaining LuaLS diagnosticsLewis Russell1
2025-01-14refactor: use nvim.foo.bar format for autocommand groupsMaria José Solano1
2025-01-11docs: miscdundargoc1
Co-authored-by: Axel <axelhjq@gmail.com> Co-authored-by: Colin Kennedy <colinvfx@gmail.com> Co-authored-by: Daiki Noda <sys9kdr@users.noreply.github.com> Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com> Co-authored-by: Jean-Jacq du Plessis <1030058+jj-du-plessis@users.noreply.github.com> Co-authored-by: Juan Giordana <juangiordana@gmail.com> Co-authored-by: Lincoln Wallace <locnnil0@gmail.com> Co-authored-by: Matti Hellström <hellstrom@scm.com> Co-authored-by: Steven Locorotondo <steven.locorotondo@justeattakeaway.com> Co-authored-by: Yochem van Rosmalen <git@yochem.nl> Co-authored-by: glepnir <glephunter@gmail.com> Co-authored-by: ifish <fishioon@live.com>
2024-12-07refactor: add vim._resolve_bufnrLewis Russell1
2024-11-25fix(lsp): retrigger diagnostics request on server cancellation (#31345)Gregory Anders1
Co-authored-by: Jesse <github@jessebakker.com>
2024-11-25refactor(lsp): rename `offset_encoding` to `position_encoding` #31286Yi Ming1
Problem: LSP spec uses the term "position encoding" where we say "offset encoding". Solution: - Rename it everywhere except `vim.lsp.Client.offset_encoding` (which would be breaking). - Mention "position encoding" in the documentation for `vim.lsp.Client.offset_encoding`.
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-10-17perf(validate): use lighter versionLewis Russell1
- Also fix `vim.validate()` for PUC Lua when showing errors for values that aren't string or number.
2024-08-27feat(lsp): export diagnostic conversion functions (#30064)Maria José Solano1
2024-08-26fix(lsp): log when receiving markup messages (#30065)Maria José Solano1
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-03-06fix(lsp): actually send diagnostic-tags back to the serverLewis Russell1
Fixes #27318