| Commit message (Collapse) | Author | Age |
| |
|
|
|
|
|
|
|
|
|
|
| |
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).
|
| |\ |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Problem: when the highlighting surrounding the diagnostics section is
not StatusLine[NC], the in-section highlights are not combined and not
correctly reset afterwards.
The spaces between the diagnostic items have the highlight of the item
to the left, which looks bad when the Diagnostic* highlight groups are
customised with background colour or underlines.
Solution: use %$ to combine, and %#(...%#) to reset.
ref #36685
ref #35806
|
| |/
|
|
| |
AI-assisted
|
| |
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
|
| |
Quickfix entries can omit their start and end positions. Default absent
start coordinates to the first position and absent end coordinates to
the start, avoiding arithmetic and comparisons on nil. Cover both cases
in the conversion tests.
AI-assisted
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
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".
|
| | |
|
| |
|
|
|
| |
Problem: Redrawing when a loaded buffer is not shown in any window on
the current tabpage.
Solution: Check that buffer is shown in a (normal) window before redrawing.
|
| |
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
| |
Co-authored-by: michael-grunder <michael.grunder@gmail.com>
Co-authored-by: Olivia Kinnear <git@superatomic.dev>
Co-authored-by: Felipe Matarazzo <felipemps@protonmail.com>
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
| |
Problem:
`diagnostic.status` only follows the `config.status.format` setting to determine how to display diagnostic signs. However, `signs` can actually also be configured via `config.signs.text`.
Solution:
If the user has set symbols via `config.status.format`, let that determine the content of `signs`; otherwise, use `config.signs.text` for display.
TODO: drop support `type(config.status.format) == 'table'`; users should just configure `config.signs.text` directly.
|
| |
|
|
|
| |
Allow `bufnr` as a positional param name because it is very common.
However as a field name, or part of a function name, it is usually
a mistake.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
| |
Problem: Multi-line diagnostics always render virtual lines below lnum.
Solution: Use end_lnum when placing the virt_lines extmark.
|
| |
|
|
|
|
| |
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`.
|
| |
|
|
|
|
|
|
| |
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().
|
| | |
|
| |
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
refactor(lua): add integer coercion helpers
Add vim._tointeger() and vim._ensure_integer(), including optional base
support, and switch integer-only tonumber()/assert call sites in the Lua
runtime to use them.
This also cleans up related integer parsing in LSP, health, loader, URI,
tohtml, and Treesitter code.
supported by AI
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
If a server is slow with catching up, there can be stale diagnostics
for deleted lines. Then if a user uses `jump` it can error like:
E5108: Lua: ...runtime/lua/vim/diagnostic.lua:670: attempt to index a nil value
stack traceback:
...runtime/lua/vim/diagnostic.lua:670: in function 'get_logical_pos'
...runtime/lua/vim/diagnostic.lua:687: in function 'diagnostic_lines'
...runtime/lua/vim/diagnostic.lua:1122: in function 'next_diagnostic'
...runtime/lua/vim/diagnostic.lua:1665: in function 'jump'
Solution:
Fallback to diagnostic location. That's better than the failure.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| | |
|
| |
|
|
|
|
|
|
|
| |
Problem:
During diagnostic position adjustment we may go out of bounds
when trying to get line's length. But it's not clear what kind of
input triggers that.
Solution:
Assert and print relevant input values.
|
| |
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
| |
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.
|
| |
|
|
|
| |
Problem: random order for same-severity diagnostics, severity_sort reversed.
Solution: add stable comparison with _extmark_id tiebreaker.
|
| |
|
|
|
|
|
|
| |
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`.
|
| |
|
|
| |
Applies the appropriate `DiagnosticSign*` highlight to each group,
resetting the highlights at the end of the expression.
|
| |
|
|
|
|
|
|
| |
Problem: the opts table also is param of util.open_floating_preview,
vim.diagnostic.Opts.Float missing some fields of open_floating_preview.
Solution: diagnostic.Opts.Float extend util.open_floating_preview.Opts
Fix #29267
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes #35884
Problem: Since `once_buf_loaded` might call a callback passed to it at a
later point (which is it's reason to exist) that callback might end up
referring to stale diagnostics in a handler's `show` function. For
example, if we first call `vim.diagnostic.set` for an unloaded buffer,
then call `vim.diagnostic.reset` and only then load the buffer, we might
still see diagnostics from `vim.diagnostic.set` call, which are stale at
this point.
Solution: only keep one autocommand from the most reset `show` call and
delete it when `hide` is called.
|
| |
|
|
|
|
|
|
| |
Problem:
Diagnostics set on unloaded buffers are not shown when the buffer loads.
Solution:
Use `once_buf_loaded()` to show the diagnostics on BufRead is the buffer
is not yet loaded.
|
| |
|
| |
Type checkers complain if we pass a list of strings, but this should be allowed.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
Problem: `vim.diagnostic.get_prev()` / `vim.diagnostic.get_next()` use
logical diagnostic positions and consider extmark validity.
`vim.diagnostic.get()` only uses original positions and doesn't care
about extmark validity. This results in inconsistency between these
APIs.
Solution: use original positions in `vim.diagnostic.get_prev()` and
`vim.diagnostic.get_next()` and don't consider extmark validity to match
previous behavior, which is consistent with `vim.diagnostic.get`.
|
| |
|
|
|
| |
fix #35116
Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
|
| |
|
| |
fixes #35116
|
| |
|
|
|
|
|
|
| |
Problem:
Not easy to get a status string for diagnostics.
Solution:
- Add vim.diagnostic.status().
- Add it to the default 'statusline'.
|