aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/diagnostic.lua
Commit message (Collapse)AuthorAge
...
* refactor(diagnostic): make display handlers generic (#16137)Gregory Anders2021-10-29
| | | | | | | 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.
* fix(lsp): adjust legacy show diagnostic functions to use correct scope (#16106)Mathias Fußenegger2021-10-20
| | | * `where` was renamed to `scope`
* refactor(diagnostic)!: replace 'show_*' functions with 'open_float' (#16057)Gregory Anders2021-10-19
| | | | | | | | | | | | | | | | | | | | '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
* fix(lsp): persist diagnostic config for clientsGregory Anders2021-10-18
| | | | | Persist configuration settings set with `vim.lsp.with` and `vim.lsp.diagnostic.on_publish_diagnostics` by setting the config for the namespace associated with the client.
* refactor(diagnostic): remove get_virt_text_chunks()Gregory Anders2021-09-21
| | | | | | | | | 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.
* feat(diagnostic): add option to include diagnostic sourceGregory Anders2021-09-21
| | | | | Add an option to virtual text display and floating window previews to include diagnostic source in the diagnostic message.
* fix(diagnostic): preserve fields from LSP diagnostics via user_data (#15735)masterGregory Anders2021-09-21
| | | * 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.
* fix(diagnostic): remove check on nil return valueGregory Anders2021-09-17
| | | | | vim.diagnostic._set_signs doesn't return anything, so checking the return value will always fail.
* refactor(diagnostic): combine config() and set() callsGregory Anders2021-09-17
|
* fix(diagnostic): support severity_sortGregory Anders2021-09-17
|
* fix(diagnostic): correctly handle folder level diagnosticsGregory Anders2021-09-17
|
* fix(diagnostic): don't convert diagnostic table twiceChristian Clason2021-09-17
| | | | | | | | 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
* fix(diagnostic): remove useless highlight links (#15683)Gregory Anders2021-09-17
| | | | | | | | | | | | | | | | | | 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.
* fix(lint): remove unused parameters from deprecated functionsGregory Anders2021-09-16
|
* refactor: move vim.lsp.diagnostic to vim.diagnosticGregory Anders2021-09-15
| | | | | | | | | | | 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
* docs #15625Justin M. Keyes2021-09-10
| | | | | | | | | | | fix #12261 fix #15536 fix #15623 fix #15572 ref #14244 ref #15034 close #15555 close #14957
* Merge pull request #15504 from mjlbach/feat/change-handler-signatureMichael Lingelbach2021-09-05
|\ | | | | feat(lsp)!: change handler signature
| * feat(lsp)!: change handler signatureMichael Lingelbach2021-09-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | docs(lsp): remove private lsp.diagnostic functions from docs (#15541)Mathias Fußenegger2021-09-01
|/ | | | Both `apply_to_diagnostic_items` and `show_diagnostics` are local functions and cannot be called by users.
* docs: make Lua docstrings consistent #15255Gregory Anders2021-08-22
| | | | | | | | | | | | 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.
* feat(lsp): jump to diagnostics by position (#14795)Zi How Poh2021-08-19
|
* refactor: remove remaining references to nvim_buf_set_virtual_textGregory Anders2021-08-03
|
* feat(lsp): implement vim.lsp.diagnostic.redraw() (#15203)Gregory Anders2021-07-29
| | | | | | | | | | | | | 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.
* lsp: add vim.lsp.diagnostic.set_qflist() function (#14831)Marc Jakobi2021-07-22
| | | | * Add vim.lsp.diagnostic.set_qflist() function * replaces opts.open_loclist with unified opts.open
* fix(lsp): allow diagnostic.clear to accept nil bufnr (#15137)Gregory Anders2021-07-19
| | | | | | | 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.
* feat(lsp): allow diagnostics to be disabled for a buffer (#15134)Gregory Anders2021-07-19
| | | | | | | | | | | | | | | 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.
* feat(lsp): Make line diagnostics display prettierMathias Fussenegger2021-07-09
| | | | | | | | | | | | | | | | | | | | | | | | | 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)
* fix(lsp): restore diagnostics extmarks that were moved to the last edit line ↵Folke Lemaitre2021-07-08
| | | | (#15023)
* fix(lsp): restore diagnostics extmarks on buffer changes (#15011)Folke Lemaitre2021-07-07
|
* fix(lsp): fix severity_limit logic in set_loclistSteven Arcangeli2021-06-19
|
* docs(lsp): Clarify opts for show_line_diagnostics()Shadman2021-06-15
|
* fix(lsp): fix on_detach in lsp.diagnostic Jaehwang Jerry Jung2021-06-14
| | | | | `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.
* fix(lsp): guard against negative diagnostic line numbersOliver Marriott2021-06-13
|
* fix(lsp): cap diagnostic end range to buf lengthMichael Lingelbach2021-06-10
| | | | Closes #14743
* feat(lsp): Split out a `diagnostics_to_items` function from set_loclistMathias Fussenegger2021-06-07
| | | | | Makes it easier to re-use the logic to populate the quickfix list instead of the location list.
* feat(lsp): extend diagnostic.set_loclistViktor Kojouharov2021-06-06
| | | | add option to show workspace diagnostic instead of the current buffer's
* Merge pull request #14730 from mjlbach/feature/open_loclist_on_winMichael Lingelbach2021-06-05
|\ | | | | fix(lsp): set_loclist should target current win
| * fix(lsp): set_loclist should target current winMichael Lingelbach2021-06-05
| | | | | | | | | | | | 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.
* | feat(lsp): remove line from diagnostic quickfixMichael Lingelbach2021-06-05
|/ | | | | | Adding the line takes up valuable horizontal screen space, and also precludes using the quickfixtextfunc built into neovim due to the harcoded `|`.
* refactor(lsp): consolidate the different floating window methods into ↵Folke Lemaitre2021-05-29
| | | | open_floating_preview
* lsp: check if config is nilMarco Hinz2021-04-23
|
* lsp: sort diagnostics by severity (#14372)Marco Hinz2021-04-23
| | | | | | | | | | | | 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
* lsp: fix off-by-one in line diagnostic highlightingMarco Hinz2021-04-14
|
* feat(lsp): make hover/signature_help borders configurableelianiva2021-04-06
| | | | | | change hl groups for the example rename borders -> border
* lsp: Unopened buffers return 0 for line count, which leads to broken positionsTJ DeVries2021-03-22
|
* lsp: fix diagnostic reported on terminating EOL characterMichael Lingelbach2021-03-02
|
* lsp: client stop cleanups (#13877)Michael Lingelbach2021-02-19
| | | | | | | | * 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 features (#13528)TJ DeVries2021-01-12
| | | | | | | | | | | * lsp: Add severity_limit for other diagnostics * docs and tests * fix: lint * Add to other types * fix: lint
* lsp: Fire LspDiagnosticsChanged before returning (#13483)Josh French2020-12-23
| | | Run hook even when transitioning from some diagnostics to no diagnostics
* lsp: Add <nomodeline> to doautocmd calls (#13576)Nils2020-12-21
| | | 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>.