aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/diagnostic.lua
Commit message (Collapse)AuthorAge
* 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>.
* doc: Fix incorrect LSP diagnostic-related helptags (#13388)Kevin Fleming2020-12-09
|
* feat: Allow incremental sync & lsp flags (#13371)TJ DeVries2020-12-08
|
* lsp: Change diagnosticg.get_all to return {bufnr: Diagnostic[]} (#13310)Mathias Fußenegger2020-12-03
| | | Allows users to associate the diagnostics with the right bufnr.
* lsp: Expose all diagnostics (#13285)Mathias Fußenegger2020-11-14
| | | | | | | | | | | | | | | * 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.
* doc: fixup sign information (#13281)TJ DeVries2020-11-13
| | | Thanks to @sunzoje for finding the outdated documentation.
* lsp: vim.lsp.diagnostic (#12655)TJ DeVries2020-11-12
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)