aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/diagnostic
Commit message (Collapse)AuthorAge
* fix(diagnostic): use logical positions for counted jumps #42394Volodymyr Chernetskyi3 days
| | | | | | | | | | | | | Problem: After edits move diagnostic ranges, counted jumps resume searching from their original positions. This can revisit the same diagnostic and hang the default first/last diagnostic mappings. Solution: Advance the search origin using the diagnostic's current logical position. Test forward and backward counted jumps after inserting or deleting a line, including jumps to the last or first diagnostic without wrapping. AI-assisted
* feat(diagnostic): add source option to virtual_lines handler (#42371)Aradhya Jain4 days
| | | | | | | | | | | | vim.diagnostic.Opts.VirtualText has a `source` option to prefix diagnostic messages with their source (`'if_many'` or always), but the newer virtual_lines handler never got the same option, even though the shared helpers it needs (diagnostic_shared.prefix_source/count_sources) are already render-target-agnostic and used by virtual_text as-is. Add the same `source` field to vim.diagnostic.Opts.VirtualLines and apply it in the virtual_lines handler right after message formatting, mirroring virtual_text's own ordering (format first, then prefix the source onto the already-formatted message).
* fix(diagnostic): "Failed to delete autocmd" after noautocmd bwipeout #42303Justin M. Keyes8 days
| | | | | | | | | | | Problem: Handlers defer `show()` on unloaded buffers with a buffer-local BufRead autocmd whose id is stored per-namespace: - `noautocmd bwipeout` deletes the autocmd, so the next show/hide fails. - Showing another buffer in the same namespace cancels the pending show. Solution: Handlers skip unloaded buffers. The existing global BufRead autocmd shows cached diagnostics when the buffer loads.
* fix(lua): enable param-type-mismatch diagnosticLewis Russell2026-09-28
| | | | | | | | | Problem: Argument type mismatches are excluded from EmmyLua checks. Solution: Correct runtime annotations and calls, document local checker workarounds, and enable the diagnostic. AI-assisted
* fix(lua): enable unnecessary-assert diagnosticLewis Russell2026-09-28
| | | | AI-assisted
* fix(lua): enable assignment type checking in runtime codeLewis Russell2026-09-25
| | | | | | | | | | | Enable EmmyLua's assign-type-mismatch diagnostic after correcting the runtime annotations and assignments it flags. Correct option, tuple, and return types, and use separate locals when a value changes representation. Add guards and narrow casts where needed so the runtime passes the stricter check. Regenerate the affected docs. AI-assisted
* fix(lua): enable nil-safety diagnostics in runtime codeLewis Russell2026-09-25
| | | | | | | | | | | | Enable EmmyLua's need-check-nil diagnostic and resolve nullable values through more precise types, explicit invariants, and guards for missing runtime state. Keep analyzer-specific workarounds local and update the affected API documentation. Exclude the bundled re.lua from analysis so its nil-check warnings do not fail CI. AI-assisted
* fix(lua): add missing param annotations (#41911)Lewis Russell2026-09-15
|
* build: enable more EmmyLua checksLewis Russell2026-09-09
| | | | | | | | | | Enable checks for unused code, deprecated calls, return types, and annotations. Fix the warnings and replace the deprecated highlight function. Keep exceptions where old APIs are still needed or the checker gets it wrong. AI-assisted
* build: enable more EmmyLua checksLewis Russell2026-09-08
| | | | | | | | | | | | | | | | - call-non-callable - missing-fields - redefined-label - redefined-local - undefined-field - unreachable-code Promote redefined-local and unreachable-code to warnings. Fix DOS line-ending handling for multiline semantic tokens, and support intersection types in the help parser. AI-assisted
* fix(diagnostic): don't accumulate BufRead autocmds for unloaded buffers #40869Nathan B.2026-08-13
| | | | | | | | | | | | | | | Problem: vim.diagnostic.set() defers extmark position computation for an unloaded buffer via a once=true BufRead autocmd, registering a new one on every call without replacing the previous one. Each pending autocmd also retains that call's diagnostics. Solution: Instead of registering an autocmd per set() call, register a single static BufRead autocmd that computes positions from the diagnostic cache for any buffer with cached diagnostics when it is read. This removes the per-call registration entirely (nothing left to accumulate) and means diagnostics cleared while the buffer was unloaded no longer produce stale extmarks.
* fix(diagnostic): skip out-of-range lnum in underline handler #40839penglei2026-07-20
| | | | | | | | | | | | | | | | Problem: `vim.diagnostic.handlers.underline.show` throws `E565: Index out of bounds` when it tries to underline a diagnostic whose `lnum` is past the end of the buffer. This happens with stale diagnostics set on an unloaded buffer (e.g. via `bufadd()`) that are drawn only after the buffer is loaded: by then the file on disk can be shorter than the `lnum` the diagnostic carried. File pickers (snacks.nvim) that open files via `bufadd` + `:buffer` hit this whenever an LSP server has already emitted diagnostics for that URI. Solution: Skip diagnostics with an out-of-range `lnum` in the underline handler. Other handlers `M.virtual_text.show()`, `M.signs.show()`, have a similar condition.
* refactor(api): omit optional paramJustin M. Keyes2026-07-13
|
* fix(lsp): unclear error on malformed server responses #40422Kim A. Brandt2026-07-12
| | | | | | | | | Problem: Malformed server responses with `null` (vim.NIL) values, do not show clear error messages. Solution: Assert two known, specific cases, to avoid user confusion.
* feat(diagnostic): debounce current-line render #39542Oleh Volynets2026-06-15
| | | | | | | | | | | Problem: vim.diagnostic.Opts.VirtualLines.current_line and vim.diagnostic.Opts.VirtualText.current_line cause redraw on every CursorMoved event that makes the text jump uncomfortably with rapid cursor movement. Solution: `current_line` state is applied only on CursorHold, while still being cleared on CursorMoved making it so that until the cursor has stopped on a line, its diagnostic looks like cursor is not on the line preventing flicker.
* feat(diagnostic): add virt_lines_overflow option for virtual_lines #40178John Reid2026-06-13
| | | | | | | Problem: Diagnostic virtual lines are hardcoded with "scroll" for virt_lines_overflow option. Solution: Add a `overflow` option to `virtual_lines` config to support "wrap", "scroll", "trunc", and "auto".
* fix(diagnostic): stack _tags hl-groups in a single extmark #38654Artem Krinitsyn2026-06-02
| | | | | | | | | | | | Problem: Diagnostic highlight groups were applied by iterating and calling `vim.hl.range` for each group individually. That resulted in multiple extmarks with the same priority being created separately, which does not allow `DiagnosticUnnecessary` and `DiagnosticDeprecated` with matching options override `Diagnostic*` styling. Solution: Pass the list of hl-groups to `vim.hl.range` so they are applied together in the correct order.
* refactor: introduce nvim_on internally #39883Justin M. Keyes2026-05-20
| | | | | | | | | Problem: `nvim_create_autocmd` is too verbose and its `callback` requires extra "nesting". Solution: Introduce `nvim_on`. Start using it internally. Then we can get a feel for how it should look before making it public.
* fix(diagnostic): handle `signs = false` in `status()` (#39703)Maria Solano2026-05-09
|
* feat(lua)!: vim.isnil, vim.nonnil, deprecate vim.F #39495Olivia Kinnear2026-05-06
|
* refactor: update usages of deprecated "buffer" param #39089Justin M. Keyes2026-04-15
|
* refactor(diagnostic): split diagnostic moduleLewis Russell2026-04-15
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