| Commit message (Collapse) | Author | Age |
|
|
| |
* preserve fields from LSP diagnostics via adding a user_data table to the diagnostic, which can hold arbitrary data in addition to the lsp diagnostic information.
|
|
|
|
|
| |
vim.diagnostic._set_signs doesn't return anything, so checking the
return value will always fail.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
The recursive implementation of vim.lsp.diagnostic.get() applied
`diagnostic_vim_to_lsp` twice, and the second time gave wrong
results because of the unexpected format.
Fixes https://github.com/neovim/neovim/issues/15689
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These links were actually defined backwards: the highlight groups
actually being used for display are the new "Diagnostic*" groups, so
linking the old "LspDiagnostics*" groups to these does absolutely
nothing, since there is nothing actually being highlighted with the
LspDiagnostics* groups.
These links were made in an attempt to preserve backward compatibility
with existing colorschemes. We could reverse the links to maintain this
preservation, but then that disallows us from actually defining default
values for the new highlight groups.
Instead, just remove the links and be done with the old LspDiagnostics*
highlight groups.
This is not technically a breaking change: the breaking change already
happened in #15585, but this PR just makes that explicit.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
fix #12261
fix #15536
fix #15623
fix #15572
ref #14244
ref #15034
close #15555
close #14957
|
|\
| |
| | |
feat(lsp)!: change handler signature
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Previously, the handler signature was:
function(err, method, params, client_id, bufnr, config)
In order to better support external plugins that wish to extend the
protocol, there is other information which would be advantageous to
forward to the client, such as the original params of the request that
generated the callback.
In order to do this, we would need to break symmetry of the handlers, to
add an additional "params" as the 7th argument.
Instead, this PR changes the signature of the handlers to:
function(err, result, ctx, config)
where ctx (the context) includes params, client_id, and bufnr. This also leaves
flexibility for future use-cases.
BREAKING_CHANGE: changes the signature of the built-in client handlers, requiring
updating handler calls
|
|/
|
|
| |
Both `apply_to_diagnostic_items` and `show_diagnostics` are local
functions and cannot be called by users.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The official developer documentation in in :h dev-lua-doc specifies to
use "--@" for special/magic tokens. However, this format is not
consistent with EmmyLua notation (used by some Lua language servers) nor
with the C version of the magic docstring tokens which use three comment
characters.
Further, the code base is currently split between usage of "--@",
"---@", and "--- @". In an effort to remain consistent, change all Lua
magic tokens to use "---@" and update the developer documentation
accordingly.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add a new function to redraw diagnostics from the current diagnostic
cache, without receiving a "publishDiagnostics" message from the server.
This is already being done in two places in the Lua stdlib, so this
function unifies that functionality in addition to providing it to third
party plugins.
An example use case for this could be a command or key-binding for
toggling diagnostics virtual text. The virtual text configuration option
can be toggled using `vim.lsp.with` followed by
`vim.lsp.diagnostic.redraw()` to immediately redraw the diagnostics
with the updated setting.
|
|
|
|
| |
* Add vim.lsp.diagnostic.set_qflist() function
* replaces opts.open_loclist with unified opts.open
|
|
|
|
|
|
|
| |
Passing `nil` is equivalent to passing 0, i.e. it simply uses the
current buffer number.
This fixes a bug when vim.lsp.diagnostic.disable() is called without
arguments.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add two new methods to allow diagnostics to be disabled (and re-enabled)
in the current buffer. When diagnostics are disabled they are simply not
displayed to the user, but they are still sent by the server and
processed by the client.
Disabling diagnostics can be helpful in a number of scenarios. For
example, if one is working on a buffer with an overwhelming amount of
diagnostic warnings it can be helpful to simply disable diagnostics
without disabling the LSP client entirely. This also allows users more
flexibility on when and how they may want diagnostic information to be
displayed. For example, some users may not want to display diagnostic
information until after the buffer is first written.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adds indentation that matches the number prefix to ensure diagnostic
messages spawning multiple lines align.
Before:
Diagnostics:
1. • Variable not in scope: red :: t0 -> t
• Perhaps you meant one of these:
‘rem’ (imported from Prelude), ‘read’ (imported from Prelude),
‘pred’ (imported from Prelude)
2. • Variable not in scope: repeDoubleColon :: [Char] -> t0
• Perhaps you meant ‘replaceDoubleColon’ (line 32)
After:
Diagnostics:
1. • Variable not in scope: red :: t0 -> t
• Perhaps you meant one of these:
‘rem’ (imported from Prelude), ‘read’ (imported from Prelude),
‘pred’ (imported from Prelude)
2. • Variable not in scope: repeDoubleColon :: [Char] -> t0
• Perhaps you meant ‘replaceDoubleColon’ (line 32)
|
|
|
|
| |
(#15023)
|
| |
|
| |
|
| |
|
|
|
|
|
| |
`lsp.diagnostic.get_all()` was returning diagnotics for `:bwipeout`-ed
buffers because the diagnostic cache is not cleared. The first argument
of on_detach callback is the string "detach", not the bufnr.
|
| |
|
|
|
|
| |
Closes #14743
|
|
|
|
|
| |
Makes it easier to re-use the logic to populate the quickfix list
instead of the location list.
|
|
|
|
| |
add option to show workspace diagnostic instead of the current buffer's
|
|\
| |
| | |
fix(lsp): set_loclist should target current win
|
| |
| |
| |
| |
| |
| | |
Currently, for large number of diagnostics, the delay in populating
loclist may be sufficient for a user to switch to another window,
resulting in the loclist being populated on the wrong window.
|
|/
|
|
|
|
| |
Adding the line takes up valuable horizontal screen space, and also
precludes using the quickfixtextfunc built into neovim due to the
harcoded `|`.
|
|
|
|
| |
open_floating_preview
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Allow to sort diagnostics (and thus signs and virtual text) by severity, so that
the most important message is shown first.
vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
severity_sort = true,
}
)
Fixes https://github.com/neovim/neovim/issues/13929
|
| |
|
|
|
|
|
|
| |
change hl groups for the example
rename borders -> border
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
* lsp: client stop cleanups
* Add diagnostic clearing to client.stop() method used by nvim-lspconfig
* Clear diagnostic cache to prevent stale diagnostics on client restart
* lsp: Add test for vim.lsp.diagnostic.reset
|
|
|
|
|
|
|
|
|
|
|
| |
* lsp: Add severity_limit for other diagnostics
* docs and tests
* fix: lint
* Add to other types
* fix: lint
|
|
|
| |
Run hook even when transitioning from some diagnostics to no diagnostics
|
|
|
| |
When using "au User LspDiagnosticsChanged redrawstatus!", modelines get processed again (see h: doautocmd). Fortunately this can be suppressed using the <nomodeline> flag. this replaces every doautocmd call, that issues a User command, with doautocmd <nomodeline>.
|
| |
|
| |
|
|
|
| |
Allows users to associate the diagnostics with the right bufnr.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lsp: Remove duplicate `diagnostics` fallback in diagnostic.display
* lsp: Expose all diagnostics
Before the changes in #12655 it was possible to retrieve all diagnostics
via `vim.lsp.util.diagnostics_by_buf`.
This adds a `diagnostic.get_all()` to enable users to retrieve all
diagnostics.
Use cases for that could include loading all diagnostics into the
quickfix list, or to build an enhanced goto_next that can move across
buffers.
|
|
|
| |
Thanks to @sunzoje for finding the outdated documentation.
|
|
Breaking Changes:
- Deprecated all `vim.lsp.util.{*diagnostics*}()` functions.
- Instead, all functions must be found in vim.lsp.diagnostic
- For now, they issue a warning ONCE per neovim session. In a
"little while" we will remove them completely.
- `vim.lsp.callbacks` has moved to `vim.lsp.handlers`.
- For a "little while" we will just redirect `vim.lsp.callbacks` to
`vim.lsp.handlers`. However, we will remove this at some point, so
it is recommended that you change all of your references to
`callbacks` into `handlers`.
- This also means that for functions like |vim.lsp.start_client()|
and similar, keyword style arguments have moved from "callbacks"
to "handlers". Once again, these are currently being forward, but
will cease to be forwarded in a "little while".
- Changed the highlight groups for LspDiagnostic highlight as they were
inconsistently named.
- For more information, see |lsp-highlight-diagnostics|
- Changed the sign group names as well, to be consistent with
|lsp-highlight-diagnostics|
General Enhancements:
- Rewrote much of the getting started help document for lsp. It also
provides a much nicer configuration strategy, so as to not recommend
globally overwriting builtin neovim mappings.
LSP Enhancements:
- Introduced the concept of |lsp-handlers| which will allow much better
customization for users without having to copy & paste entire files /
functions / etc.
Diagnostic Enhancements:
- "goto next diagnostic" |vim.lsp.diagnostic.goto_next()|
- "goto prev diagnostic" |vim.lsp.diagnostic.goto_prev()|
- For each of the gotos, auto open diagnostics is available as a
configuration option
- Configurable diagnostic handling:
- See |vim.lsp.diagnostic.on_publish_diagnostics()|
- Delay display until after insert mode
- Configure signs
- Configure virtual text
- Configure underline
- Set the location list with the buffers diagnostics.
- See |vim.lsp.diagnostic.set_loclist()|
- Better performance for getting counts and line diagnostics
- They are now cached on save, to enhance lookups.
- Particularly useful for checking in statusline, etc.
- Actual testing :)
- See ./test/functional/plugin/lsp/diagnostic_spec.lua
- Added `guisp` for underline highlighting
NOTE: "a little while" means enough time to feel like most plugins and
plugin authors have had a chance to refactor their code to use the
updated calls. Then we will remove them completely. There is no need to
keep them, because we don't have any released version of neovim that
exposes these APIs. I'm trying to be nice to people following HEAD :)
Co-authored: [Twitch Chat 2020](https://twitch.tv/teej_dv)
|