| Commit message (Collapse) | Author | Age |
... | |
|
|
|
| |
The 'prefix' option accepts a function or a string that is used to add a
prefix string to each diagnostic displayed in the floating window.
|
|
|
|
|
|
|
| |
Also fix a few other small bugs regarding saving and restoring extmarks.
In particular, now that the virtual text and underline handlers have
their own dedicated namespaces, they should be responsible for saving
and restoring their own extmarks. Also fix the wrong argument ordering
in the call to `clear_diagnostic_cache` in the `on_detach` callback.
|
| |
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Setting focus_id allows the float to be focused by calling the function
a second time (a feature of open_floating_preview).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
'show_line_diagnostics()' and 'show_position_diagnostics()' are
almost identical; they differ only in the fact that the latter also
accepts a column to form a full position, rather than just a line. This
is not enough to justify two separate interfaces for this common
functionality.
Renaming this to simply 'show_diagnostics()' is one step forward, but
that is also not a good name as the '_diagnostics()' suffix is
redundant. However, we cannot name it simply 'show()' since that
function already exists with entirely different semantics.
Instead, combine these two into a single 'open_float()' function that
handles all of the cases of showing diagnostics in a floating window.
Also add a "float" key to 'vim.diagnostic.config()' to provide global
values of configuration options that can be overridden ephemerally.
This makes the float API consistent with the rest of the diagnostic API.
BREAKING CHANGE
|
|
|
|
|
|
|
|
|
|
|
| |
When using `true` as the value of a configuration option, the option is
configured to use default values. For example, if a user configures
virtual text to include the source globally (using
vim.diagnostic.config) and a specific namespace or producer configures
virtual text with `virt_text = true`, the user's global configuration is
overriden.
Instead, interpret a value of `true` to mean "use existing settings if
defined, otherwise use defaults".
|
|
|
|
|
|
|
| |
Users can pass string values for severities that match with the enum
names (e.g. "Warn" or "Info") which are converted to the corresponding
numerical value in `to_severity`. Invalid strings were simply left
as-is, which caused confusing errors later on. Instead, report an
invalid severity string right up front to make the problem clear.
|
|
|
| |
Support the severity_sort option for show_{line,position}_diagnostics.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Always make calls to `vim.diagnostic.set` call `vim.diagnostic.show`.
This creates an easier to reason about code path and is also less
surprising when users wish to override override `vim.diagnostic.show`
with custom behavior and `vim.diagnostic.set` is called with empty
diagnostics.
Functionally, the end result is the same: when `show` is called with an
empty diagnostics list, it just calls `hide` and then returns, which is
exactly what `reset` does right now.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Many vim.diagnostic functions expect the user to pass in a namespace id.
This PR allows the user to list active diagnostic namespaces:
```lua
:lua print(vim.inspect(vim.diagnostic.get_namespaces()))
{
[7] = {
name = "vim.lsp.client-1",
opts = {},
sign_group = "vim.diagnostic.vim.lsp.client-1"
}
}
```
|
|
|
|
| |
This feature was added in #15785, but the docs for
vim.diagnostic.config() weren't updated.
|
|
|
|
|
|
|
| |
Rather than relying on the order in which signs are placed to dictate
the order in which they are displayed, explicitly set the priority of
the sign according to the severity of the diagnostic and the value of
severity_sort. If severity_sort is false or unset then all signs use the
same priority.
|
| |
|
|
|
|
|
|
| |
diagnostic_lines() returns a table, so make the early exit condition an
empty table rather than 'nil'. This way, functions that use the input
from diagnostic_lines don't have to do a bunch of defensive nil checking
and can always assume they're operating on a table.
|
|
|
|
| |
Provide a 'format' option for virtual text and floating window previews
that allows the displayed text of a diagnostic to be customized.
|
|
|
|
|
|
|
|
|
| |
This function isn't compatible with including diagnostic sources when
"source" is "if_many" since it only has access to diagnostics for a
single line. Rather than having an inconsistent or incomplete interface,
make this function private. It is still exported as part of the module
for backward compatibility with vim.lsp.diagnostics, but it can
eventually be made into a local function.
|
|
|
|
|
| |
Add an option to virtual text display and floating window previews to
include diagnostic source in the diagnostic message.
|
|
|
|
|
|
| |
Some parts of LSP need to use cached diagnostics as sent from the LSP
server unmodified. Rather than fixing invalid line numbers when
diagnostics are first set, fix them when they are displayed to the user
(e.g. in show() or one of the get_next/get_prev family of functions).
|
|
|
|
|
|
| |
* feat(diagnostic): add vim.diagnostic.match()
Provide vim.diagnostic.match() to generate a diagnostic from a string and
a Lua pattern.
* feat(diagnostic): add tolist() and fromlist()
|
|
|
|
|
| |
When vim.diagnostic.config() is called, the decorations for diagnostics
are re-displayed to use the new configuration. This should only be done
for loaded buffers.
|
| |
|
| |
|
|
|
|
|
|
|
| |
When severity_sort is true, higher severities should be displayed before
lower severities (e.g. ERROR is displayed over WARN).
Also improved the test case for this.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
The documentation claims to default to the current line number if
the argument `lnum` is nil, but that was never actually done.
Fixes https://github.com/neovim/neovim/issues/15690
|
|
|
|
| |
Fixup for https://github.com/neovim/neovim/pull/15585
Closes https://github.com/neovim/neovim/issues/15686
|
| |
|
|
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
|