summaryrefslogtreecommitdiffstatshomepage
path: root/test/functional/lua/diagnostic_spec.lua
AgeCommit message (Collapse)AuthorFiles
2026-04-15refactor: update usages of deprecated "buffer" param #39089Justin M. Keyes1
2026-04-15refactor(diagnostic): split diagnostic moduleLewis Russell1
Extract the diagnostic implementation from runtime/lua/vim/diagnostic.lua into focused internal modules covering config, display, float rendering, jump/list helpers, namespace and storage management, severity/shared utilities, and statusline support. Move the builtin handlers into runtime/lua/vim/diagnostic/handlers/ and keep runtime/lua/vim/diagnostic.lua as the public facade that lazily dispatches to the split modules. This preserves the external vim.diagnostic API while making the implementation easier to navigate and reason about. AI-assisted: Codex
2026-04-06fix(diagnostic): virtual_lines should anchor at end_lnum, not lnum #38701glepnir1
Problem: Multi-line diagnostics always render virtual lines below lnum. Solution: Use end_lnum when placing the virt_lines extmark.
2026-03-16fix(diagnostic): open_float() handles config.float function #31577glepnir1
Problem: The `float` field of vim.diagnostic.config can be a function, but diagnostic.open_float() does not handle it correctly. Solution: Add handling for it in open_float().
2026-03-13feat(diagnostic): custom status format function #36696Oleh Volynets1
Problem: Statusline component of diagnostics allows only the default format "sign:count". Solution: Extend vim.diagnostic.Opts.Status to allow a custom signs or formatting function that provides the status presentation.
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-14feat(diagnostic): fromqflist({merge_lines}) #37416Dmytro Pletenskyi1
Problem: `vim.diagnostic.fromqflist` ignores lines that are `item.valid == 0` (see `getqflist`). Many qflists have messages that span multiple lines, which look like this: collection/src/Modelling/CdOd/Central.hs|496 col 80| error: [GHC-83865] || • Couldn't match expected type: InstanceWithForm || (FilePath || -> SelectValidCdInstWithForm ... calling `vim.diagnostic.fromqflist(vim.fn.getqflist)` gets a diagnostic message like this: error: [GHC-83865] only the first line is kept, but often, the remaing lines are useful as well. Solution: Introduce `merge_lines` option, which "squashes" lines from invalid qflist items into the error message of the previous valid item, so that we get this diagnostic message instead: error: [GHC-83865] • Couldn't match expected type: InstanceWithForm (FilePath -> SelectValidCdInstWithForm
2026-01-04fix(diagnostic): display 1-based related information line/col numbers (#37093)Robert Muir1
Problem LSP Related Information line and column numbers are 0-based. Displaying them this way can confuse the user, since vim line/col numbers are typically displayed 1-based. Solution Display the line and column numbers as 1-based.
2026-01-02fix(diagnostic): check for extmark in get_logical_pos #37127Kira Kawai1
Problem: The function get_logical_pos did not account for the possibility that a diagnostic might not have an associated extmark, leading to potential errors or incorrect behavior. Solution: Add a check for diagnostic._extmark_id and return the logical positions directly if it does not exist.
2025-12-30fix(diagnostic): unstable sorting by severity #37154glepnir1
Problem: random order for same-severity diagnostics, severity_sort reversed. Solution: add stable comparison with _extmark_id tiebreaker.
2025-11-25feat(diagnostic): config.status #36693Maria Solano1
Problem: `diagnostic.status()` is configured via `config.signs`, but users may want diagnostics only in statusline, not in the gutter (signs). Solution: Add `config.status`.
2025-11-25feat(diagnostic): highlights in diagnostic.status() #36685Riley Bruins1
Applies the appropriate `DiagnosticSign*` highlight to each group, resetting the highlights at the end of the expression.
2025-11-17feat(diagnostics): stack DiagnosticUnnecessary,DiagnosticDeprecated ↵Grzegorz Rozdzialik1
highlights #36590 Problem: unnecessary and deprecated diagnostics use their own highlight groups (`DiagnosticUnnecessary` and `DiagnosticDeprecated`) which override the typical severity-based highlight groups (like `DiagnosticUnderlineWarn`). This can be misleading, since diagnostics about unused variables which are warnings or errors, are shown like comments, since then only the `DiagnosticUnnecessary` highlight group is used. Users do not see the more eye-catching red/yellow highlight. Solution: Instead of overriding the highlight group to `DiagnosticUnnecessary` or `DiagnosticDeprecated`, set them in addition to the normal severity-based highlights.
2025-07-29feat(statusline): vim.diagnostic.status() #33723Anton Kastritskii1
Problem: Not easy to get a status string for diagnostics. Solution: - Add vim.diagnostic.status(). - Add it to the default 'statusline'.
2025-07-28fix(diagnostics): avoid jumping to diagnostics in deleted ranges #35088Sergei Slipchenko1
Problem: diagnostic extmark used for positioning continues to exist after deleting a range containing it, so it's possible to jump to a next/previous diagnositc, which isn't visible in any way, including not being shown via `open_float`. Solution: enable `invalidate` flag when setting an extmark to be able to filter out diagnostics based on `invalid` flag when looking for next/previous diagnostic to jump to.
2025-07-25fix(diagnostics): position diagnostics using extmarks #34014Sergei Slipchenko1
Problem: Diagnostic positions are not being updated after text changes, which means `vim.diagnostic.open_float` and `vim.diagnostic.jump` will work with outdated positions when text is changed until diagnostics are updated again (if ever). Solution: Create extmarks in `vim.diagnostic.set` and use their positions for `vim.diagnostic.open_float` and `next_diagnostic` (used by `vim.diagnostic.jump`, `vim.diagnostic.get_next` and `vim.diagnostic.get_prev`).
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-06-05fix(diagnostic): ensure autocmd always is always sent diagnosticsLewis Russell1
2025-05-21fix(diagnostic): accept multiple namespace in `open_float()` (#34073)Maria José Solano1
2025-05-21fix(diagnostics): fixed virtual_text cursormoved autocmd error (#34017)Rijul Kapoor1
2025-05-13feat(diagnostic): add `enabled` filter (#33981)Maria José Solano1
2025-05-12feat(diagnostic): add `format` option to `setloclist`/`setqflist` (#33977)Maria José Solano1
2025-05-12fix(diagnostic): accept multiple namespaces when setting loclist/qflist (#33982)Maria José Solano1
2025-05-05feat(diagnostic): add `on_jump` callback optionMaria José Solano1
2025-05-01fix(diagnostic): allow virtual_{lines,text} cursor exclusivity #33517Michael Clayton1
Problem: virtual_text diagnostics are great when skimming a file, and virtual_lines are great when "zooming in" on a particular problem. Having both enabled results in duplicate diagnostics on-screen. Solution: This PR expands the behavior of `current_line` for virtual_text and virtual_lines by making `virtual_text.current_line = false` distinct from `nil`. If you set: vim.diagnostic.config({ virtual_text = { current_line = false }, virtual_lines = { current_line = true }, }) With this configuration, virtual_text will be used to display diagnostics until the cursor reaches the same line, at which point they will be hidden and virtual_lines will take its place.
2025-03-26refactor(diagnostic)!: remove deprecated diagnostic APIs (#33072)Gregory Anders1
2025-03-26fix: temporarily disable 0.12 deprecation testsJustin M. Keyes1
Re-enable these after release.
2025-03-04fix(diagnostic): virtual_lines diagnostic columns (#32703)James Trew1
When multiple diagnostics appear on a single line, the virtual lines for all diagnostics except the first were rendered with progressively fewer columns.
2025-02-05feat(diagnostic): add `current_line` option for `virtual_text` handlerMaria José Solano1
2025-02-03feat(diagnostic): format() can filter diagnostics by returning nil #32302Maria José Solano1
2025-01-26feat(diagnostic): virtual_lines #31959Maria José Solano1
2025-01-18fix(diagnostic)!: make virtual text handler opt-in (#32079)Gregory Anders1
Making this opt-out (on by default) was the wrong choice from the beginning. It is too visually noisy to be enabled by default. BREAKING CHANGE: Users must opt-in to the diagnostic virtual text handler by adding vim.diagnostic.config({ virtual_text = true }) to their config.
2024-12-16fix(diagnostic): vim.diagnostic.setqflist() opens loclist on first call #31585Juan Cruz De La Torre1
Problem: Regression from de794f2d2409: `vim.diagnostic.setqflist{open=true}` attempts to open the location list instead of the diagnostics quickfix list if it didn't exist before. This is because we are using `qf_id` to decide which to open, but `qf_id=nil` when there is no existing diagnostics quickfix list with a given title ("Diagnostics" by default). Solution: - Revert to using `loclist` to decide which to open. - Add tests.
2024-10-27feat(diagnostics)!: sort underline severity_sort (#30898)Donatas1
feat(diagnostics)!: sort underline with severity_sort BREAKING CHANGE: underline will be applied with a higher value than `vim.hl.priorities.diagnostics`
2024-09-21test: support upvalues in exec_luaLewis Russell1
2024-08-02test: allow exec_lua to handle functionsLewis Russell1
Problem: Tests have lots of exec_lua calls which input blocks of code provided as unformatted strings. Solution: Teach exec_lua how to handle functions.
2024-06-04fix(diagnostic): fix float scope filtering (#29134)Andre Toerien1
2024-05-28feat(defaults): use vim.diagnostic.jump() for default mappings (#29066)Gregory Anders1
This allows the mappings to work with a count and also enables new ]D and [D mappings to go to the last/first diagnostic in the buffer.
2024-05-28feat(diagnostic): add vim.diagnostic.jump() (#26745)Gregory Anders1
Deprecate vim.diagnostic.goto_prev() and vim.diagnostic.goto_next() in favor of a unified vim.diagnostic.jump() interface. We cannot name the function "goto()" because some of our tooling (luacheck and stylua) fail to parse it, presumably because "goto" is a keyword in newer versions of Lua. vim.diagnostic.jump() also allows moving to a specific diagnostic and moving by multiple diagnostics at a time (useful for creating mappings that use v:count).
2024-04-30feat(diagnostic): revert default behaviour of goto_next/prev()Lewis Russell1
Follow-up to #28490 Problem: The new behaviour of goto_next/prev() of navigating to the next highest severity doesn't work well when diagnostic providers have different interpretations of severities. E.g. the user may be blocked from navigating to a useful LSP warning, due to some linter error. Solution: The behaviour of next highest severity is now a hidden option `_highest = true`. We can revisit how to integrate this behaviour during the 0.11 cycle.
2024-04-27fix(diagnostic): invalid col number compare in next_diagnostic (#28397)Raphael1
Problem: when line is blank link then there will got an invalid column number in math.min compare. Solution: make sure the min column number is 0 not an illegal number.
2024-04-25feat(diagnostic): goto functions jump to highest severity (#28490)Gregory Anders1
When the "severity" option is nil, vim.diagnostic.goto_next() and vim.diagnostic.goto_prev() jump to the next diagnostic with the highest severity.
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-23fix(diagnostic): vim.diagnostic.get(…,{lnum=…}) on multi-line diagnostic ↵Raphael1
#28273 Problem: vim.diagnostic.get(…,{lnum=…}) does not match multi-line diagnostics. Solution: add end_lnum support.
2024-04-23fix(diagnostic): open_float on multi-line diagnostics #28301Raphael1
Problem: when diagnostic have a range of line, open_float not work. Solution: filter diagnostic by line number range.
2024-04-18feat(lua): enable(enable:boolean, filter:table) #28374Justin M. Keyes1
Problem: We need to establish a pattern for `enable()`. Solution: - First `enable()` parameter is always `enable:boolean`. - Update `vim.diagnostic.enable()` - Update `vim.lsp.inlay_hint.enable()`. - It was not released yet, so no deprecation is needed. But to help HEAD users, it will show an informative error. - vim.deprecate(): - Improve message when the "removal version" is a *current or older* version.
2024-04-15feat(diagnostic): enable(…, opts)Justin M. Keyes1
Problem: vim.diagnostic.enable() does not match the signature of vim.lsp.inlay_hint.enable() Solution: - Change the signature so that the first 2 args are (bufnr, enable). - Introduce a 3rd `opts` arg. - Currently it only supports `opts.ns_id`.
2024-04-15feat(diagnostic): is_enabled, enable(…, enable:boolean)Justin M. Keyes1
Problem: `vim.diagnostic.is_disabled` and `vim.diagnostic.disable` are unnecessary and inconsistent with the "toggle" pattern (established starting with `vim.lsp.inlay_hint`, see https://github.com/neovim/neovim/pull/25512#pullrequestreview-1676750276 As a reminder, the rationale is: - we always need `enable()` - we always end up needing `is_enabled()` - "toggle" can be achieved via `enable(not is_enabled())` - therefore, - `toggle()` and `disable()` are redundant - `is_disabled()` is a needless inconsistency Solution: - Introduce `vim.diagnostic.is_enabled`, and `vim.diagnostic.enable(…, enable:boolean)` - Note: Future improvement would be to add an `enable()` overload `enable(enable:boolean, opts: table)`. - Deprecate `vim.diagnostic.is_disabled`, `vim.diagnostic.disable`
2024-04-10refactor(test): inject after_each differentlyLewis Russell1