aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/diagnostic.lua
Commit message (Collapse)AuthorAge
...
* feat(diagnostic): add 'prefix' option to open_float (#16321)Gregory Anders2021-11-14
| | | | 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.
* feat(diagnostic): do not require namespace for hide() and show() (#16261)Gregory Anders2021-11-09
| | | | | | | 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.
* fix(diagnostic): fix option resolution in open_float (#16229)Gregory Anders2021-11-04
|
* 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(diagnostic): allow floats to be focusable (#16093)Gregory Anders2021-10-19
| | | | Setting focus_id allows the float to be focused by calling the function a second time (a feature of open_floating_preview).
* fix(diagnostic): handle diagnostics placed past the end of line (#16095)Gregory Anders2021-10-19
|
* 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(diagnostic): do not override existing config settings #16043Gregory Anders2021-10-17
| | | | | | | | | | | 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".
* fix(diagnostic): error on invalid severity value (#15965)Gregory Anders2021-10-08
| | | | | | | 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.
* fix: support severity_sort option for show_diagnostic functions (#15948)Gregory Anders2021-10-07
| | | Support the severity_sort option for show_{line,position}_diagnostics.
* feat(diagnostic): update jumplist on goto_next/prev (#15942)Sean Dewar2021-10-07
|
* refactor(diagnostics): always make 'set' go through 'show'Gregory Anders2021-10-02
| | | | | | | | | | | | 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.
* feat(diagnostics): add vim.diagnostic.get_namespaces (#15866)Michael Lingelbach2021-10-01
| | | | | | | | | | | | | | | | | 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" } } ```
* docs(diagnostics): add "priority" option to signs table (#15860)Gregory Anders2021-10-01
| | | | This feature was added in #15785, but the docs for vim.diagnostic.config() weren't updated.
* refactor(diagnostic): use sign priority for severity_sort #15785Gregory Anders2021-09-26
| | | | | | | 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.
* fix(diagnostic): check for nil in show_diagnostics (#15772)Gregory Anders2021-09-23
|
* fix(diagnostic): don't return nil when callers expect a table (#15765)Gregory Anders2021-09-23
| | | | | | 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.
* feat(diagnostic): allow customized diagnostic messages (#15742)Gregory Anders2021-09-22
| | | | Provide a 'format' option for virtual text and floating window previews that allows the displayed text of a diagnostic to be customized.
* 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): clamp line numbers in display layer (#15729)Gregory Anders2021-09-20
| | | | | | 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): match(), tolist(), fromlist() #15704Gregory Anders2021-09-19
| | | | | | * 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()
* fix(diagnostic): only update decorations for loaded buffers (#15715)Gregory Anders2021-09-18
| | | | | 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.
* fix(diagnostic): resolve nil bufnr in show_line_diagnosticsGregory Anders2021-09-18
|
* refactor(diagnostic): group local functions togetherGregory Anders2021-09-17
|
* fix(diagnostic): change default severity_sort orderGregory Anders2021-09-17
| | | | | | | 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.
* fix(diagnostic): support severity_sortGregory Anders2021-09-17
|
* docs(diagnostics): fix typosGregory Anders2021-09-17
|
* fix(diagnostic): fix wrong data type in setqflist()Gregory Anders2021-09-17
|
* fix(diagnostic): don't overwrite existing sign definitionsGregory Anders2021-09-17
|
* fix(diagnostic): show_line_diagnostic with empty lnumChristian Clason2021-09-17
| | | | | | | 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
* fix(diagnostic): nvim_echo takes three args (#15687)Christian Clason2021-09-17
| | | | Fixup for https://github.com/neovim/neovim/pull/15585 Closes https://github.com/neovim/neovim/issues/15686
* refactor: remove UTF to byte col conversionGregory 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