aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/diagnostic.lua
Commit message (Collapse)AuthorAge
* feat(diagnostic): vim.diagnostic.is_disabled() #21527Raphael2023-01-12
|
* fix(diagnostic): revert notification on missing diagnostics (#21632)Gregory Anders2023-01-03
| | | | This reverts a change introduced in 4ace9e7e417fe26c8b73ff1d6042e6e4f3df9ebf.
* refactor(diagnostic): DRY for loop #21521Raphael2023-01-03
| | | Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
* feat(diagnostic): don't open quickfix/loclist if no diagnostics #21397李晓辉2022-12-30
|
* fix(diagnostic): sort diagnostics by column (#21457)tae-soo-kim2022-12-18
| | | Sort diagnostics by column number in quickfix list
* fix(diagnostic): clear stale cache on reset (#21454)Mathias Fußenegger2022-12-17
| | | | | | | | | | | | | The BufWipeout autocmd is not 100% reliable and may leave stale entries in the cache. This is sort of a hack/workaround to ensure `vim.diagnostic.reset` calls don't fail if there are stale cache entries but instead clears them Fixes errors like Error executing vim.schedule lua callback: /usr/share/nvim/runtime/lua/vim/diagnostic.lua:1458: Invalid buffer id: 22 stack traceback: [C]: in function 'nvim_exec_autocmds' /usr/share/nvim/runtime/lua/vim/diagnostic.lua:1458: in function 'reset'
* docs(gen): support language annotation in docstringsChristian Clason2022-12-02
|
* fix(diagnostic): correct type annotations; add Diagnostic type (#21120)Mathias Fußenegger2022-11-21
| | | | | Some functions didn't include the `nil` case in the return type annotation. This corrects those and also adds a Diagnostic class definition for the diagnostic.get return type
* feat(diagnostic): add `suffix` option to `virt_text` config (#21140)beardedsakimonkey2022-11-20
| | | | | | | This introduces a `suffix` option to the `virt_text` config in `vim.diagnostic.config()`. The suffix can either be a string which is appended to the diagnostic message or a function returning such. The function receives a `diagnostic` argument, which is the diagnostic table of the last diagnostic (the one whose message is rendered as virt text).
* feat(diagnostic): add `suffix` option to `open_float()` (#21130)beardedsakimonkey2022-11-20
| | | | | | | | | | | Closes #18687 This introduces a `suffix` option to `vim.diagnostic.open_float()` (and consequently `vim.diagnostic.config()`) that appends some text to each diagnostic in the float. It accepts the same types as `prefix`. For multiline diagnostics, the suffix is only appended to the last line. By default, the suffix will render the diagnostic error code, if any.
* perf(diagnostic): use api variable and improve validate (#21111)Raphael2022-11-19
| | | | | * fix(diagnostic): use api variable and improve validate * fix: fix test case
* fix(docs): nil as viable argument for goto_prev (#20852)Martin Kunz2022-10-28
| | | | Added `nil` as a possible option to `vim.diagnostics.goto_prev` in the docs
* refactor(diagnostic): remove deprecated function (#20423)Raphael2022-10-01
|
* fix(diagnostic): populate data key in DiagnosticChanged autocmd in reset ↵Gregory Anders2022-09-15
| | | | | (#20207) Follow up to #20173.
* feat(diagnostic): pass diagnostics as data to DiagnosticChanged autocmd (#20173)Gregory Anders2022-09-13
|
* fix(diagnostic): remove buf from cache on `BufWipeout` (#20099)Sean Dewar2022-09-06
| | | | | | | | | | | | | | Doing so on `BufDelete` has issues: - `BufDelete` is also fired for listed buffers that are made unlisted. - `BufDelete` is not fired for unlisted buffers that are deleted. This means that diagnostics will be lost for a buffer that becomes unlisted. It also means that if an entry exists for an unlisted buffer, deleting that buffer later will not remove its entry from the cache (and you may see "Invalid buffer id" errors when using diagnostic functions if it was wiped). Instead, remove a buffer from the cache if it is wiped out. This means simply `:bd`ing a buffer will not clear its diagnostics now.
* fix(lsp): clean the diagnostic cache when buffer delete (#19449)Raphael2022-08-29
| | | Co-authored-by: Gregory Anders <greg@gpanders.com>
* docs: fix typos (#19024)dundargoc2022-07-31
| | | | Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Valery Viktorovsky <viktorovsky@gmail.com>
* fix(lsp): move augroup define to if statement (#19406)Raphael2022-07-17
|
* refactor(lua): replace vim.cmd use with API calls (#19283)Raphael2022-07-09
| | | Signed-off-by: Raphael <glephunter@gmail.com>
* refactor(lua): reformat with stylua 0.14.0 (#19264)Christian Clason2022-07-07
| | | | * reformat Lua runtime to make lint CI pass * reduce max line length to 100
* fix(diagnostic): check for negative column value (#18868)mohsen2022-06-08
|
* chore: format runtime with styluaChristian Clason2022-05-09
|
* fix(diagnostic): use nvim_exec_autocmds to trigger DiagnosticChanged (#18188)Gregory Anders2022-04-20
| | | | | Use nvim_exec_autocmds to issue the DiagnosticChanged autocommand, rather than nvim_buf_call, which has some side effects when drawing statuslines.
* fix(diagnostic): make `open_float` respect global diagnostic options (#17879)Smitesh Patil2022-03-27
| | | | * make `open_float` respect `scope` option set in `vim.diagnostic.config` * Closes #17878
* refactor(highlight)!: optional arguments for highlight.range as table (#17462)Christian Clason2022-02-21
| | | | | | | | | also update documentation BREAKING CHANGE: signature of highlight.range is now vim.highlight.range(bufnr, ns, hlgroup, start, finish, { regtype = regtype, inclusive = inclusive, priority = priority }) Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com>
* fix(diagnostic): use botright copen for qflist (#17475)Michael Lingelbach2022-02-20
| | | | This matches the LSP handlers, and forces the qflist for diagnostics to span across the horizontal space, below all open windows.
* fix: lsp and diagnostic highlight priority (#17461)Michael Lingelbach2022-02-19
| | | | | | | | | Closes https://github.com/neovim/neovim/issues/17456 * treesitter uses the default highlight priority of 50 * diagnostic highlights have a priority of 150 * lsp reference highlights have a priority of 200 This ensures proper ordering.
* feat(diagnostic): allow retrieving current diagnostic configGregory Anders2022-01-11
|
* fix(diagnostic): only set default handler config if unsetGregory Anders2022-01-11
|
* fix(diagnostic): allow setting arbitrary config valuesGregory Anders2022-01-11
|
* fix(diagnostic): resolve nil opts tablesGregory Anders2022-01-11
| | | | | In functions which allow opts to be optional, ensure that the value actually resolves to a non-nil value.
* fix: resolve nil arguments to API functions (#16889)Gregory Anders2022-01-03
| | | | | | As revealed by #16745, some functions pass a nil value to API functions, which have been implicitly converted to 0. #16745 breaks this implicit conversion, so explicitly pass a resolved buffer number to these API functions.
* fix(diagnostic): improve validation for list arguments (#16855)Gregory Anders2022-01-01
| | | | | | Function arguments that expect a list should explicitly use tbl_islist rather than just checking for a table. This helps catch some simple errors where a single table item is passed as an argument, which passes validation (since it's a table), but causes other errors later on.
* chore: fix typos (#16506)dundargoc2021-12-28
| | | | | | | | | Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com> Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Christoph Hasse <hassec@users.noreply.github.com> Co-authored-by: Alef Pereira <ealefpereira@gmail.com> Co-authored-by: AusCyber <willp@outlook.com.au> Co-authored-by: kylo252 <59826753+kylo252@users.noreply.github.com>
* fix(diagnostic): respect "if_many" source option for virtual text (#16653)Gregory Anders2021-12-17
| | | | | | | | The `prefix_source` function only evaluates the sources from the diagnostics passed to it; however, because each namespace draws its own virtual text, its diagnostics will never contain more than a single source (by definition). This requires changing the semantics of what "if_many" means from "multiple sources in a single 'batch' of diagnostics" to "multiple sources of all diagnostics within a buffer".
* refactor(diagnostic): remove hack (#16685)Gregory Anders2021-12-16
| | | No longer required since #16548.
* fix(diagnostic): assert that diagnostics have line number and column (#16683)Gregory Anders2021-12-16
| | | | | | | Line number and column are required and much of the diagnostic API assumes that these are both present. When one of the two is missing, cryptic errors pop up in other parts of the diagnostic subsystem. Instead, assert that diagnostics are well formed when they are entered into the cache, which provides a clearer error.
* fix(diagnostic): set effective buffer number in autocmd (again) (#16589)Gregory Anders2021-12-08
| | | Follow up to #16474.
* refactor(diagnostic): remove bufnr parameter from open_float (#16579)Gregory Anders2021-12-08
| | | | | | | | | | | | | | The overwhelming majority of use cases for `open_float` are to view diagnostics from the current buffer in a floating window. Thus, most use cases will just `0` or `nil` as the first argument, which makes the argument effectively useless and wasteful. In the cause of optimizing for the primary use case, make the `bufnr` parameter an optional parameter in the options table. This still allows using an alternative buffer for those that wish to do so, but makes the "primary" use case much easier. The old signature is preserved for backward compatibility, though it can likely be fully deprecated at some point.
* refactor: format diagnostic.lua (#16540)Gregory Anders2021-12-05
|
* fix(diagnostic): escape special chars in file names (#16527)Matthew Toohey2021-12-05
| | | | Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Gregory Anders <greg@gpanders.com>
* feat(lsp,diagnostic): open folds in jump-related functions (#16520)Dmytro Meleshko2021-12-04
|
* fix(diagnostic): clamp diagnostics on negative line numbers (#16496)Michael Lingelbach2021-12-02
| | | | | | | | | Closes https://github.com/neovim/neovim/issues/16492 Despite having logic for setting the maximum diagnostic line number to at minimum 0, previously the conditional statement only checked if lnum and end_lnum were greater than the line count. Fix: also check if lnum and end_lnum are less than 0.
* fix(diagnostic): set effective buffer number for DiagnosticChanged autocmd ↵Gregory Anders2021-12-01
| | | | | | (#16474) This enables use of <abuf> in autocommand handlers for DiagnosticChanged.
* feat(lsp): add 'focus' option to open_floating_preview (#16465)Gregory Anders2021-11-29
| | | | | | | | | When the 'focusable' and 'focus_id' parameters are set, `open_floating_preview` assumes that it should always move focus to an existing floating window with the same 'focus_id'. However, there are cases where we want to make a floating window focusable, but do not want to focus it upon calling `open_floating_preview`. To distinguish these cases, add a boolean parameter 'focus' that, when false, prevents moving focus.
* feat(diagnostic): use `scope = 'line'` by default for `open_float()` (#16456)cbarrete2021-11-28
| | | | | Closes #16453 Co-authored-by: Cédric Barreteau <cbarrete@users.noreply.github.com>
* fix(diagnostic): make set() go through cache when calling show()Gregory Anders2021-11-27
| | | | | | | | | | | | | | | | When `vim.diagnostic.set()` is called, the diagnostics passed to it are added to the diagnostic cache. `set()` then calls `show()` and passes those diagnostics along exactly as they were given to `set()`. However, we sometimes want to do some kind of post-processing on diagnostics when they come out of the cache, e.g. clamping line numbers. By forwarding the diagnostics to `show()` verbatim, `set()` skips this post-processing which can cause other bugs downstream. Instead of passing the diagnostics directly, make the `show()` call from within `set()` retrieve diagnostics from the cache. In general, all diagnostics operations should follow the pattern of "producers put things in the cache" and "consumers get things out of the cache" and this change better adheres to that pattern.
* chore: fix typos (#16361)dundargoc2021-11-27
| | | | | | | | | | | | | | | | | | | | | | | | | | Co-authored-by: Brede Yabo Sherling Kristensen <bredeyabo@hotmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: István Donkó <istvan.donko@gmail.com> Co-authored-by: Julian Berman <Julian@GrayVines.com> Co-authored-by: bryant <bryant@users.noreply.github.com> Co-authored-by: Michael Lingelbach <m.j.lbach@gmail.com> Co-authored-by: nlueb <9465658+nlueb@users.noreply.github.com> Co-authored-by: Leonhard Saam <leonhard.saam@yahoo.com> Co-authored-by: Jesse Wertheim <jaawerth@gmail.com> Co-authored-by: dm1try <me@dmitry.it> Co-authored-by: Jakub Łuczyński <doubleloop@o2.pl> Co-authored-by: Louis Lebrault <louis.lebrault@gmail.com> Co-authored-by: Brede Yabo Sherling Kristensen <bredeyabo@hotmail.com> Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: István Donkó <istvan.donko@gmail.com> Co-authored-by: Julian Berman <Julian@GrayVines.com> Co-authored-by: bryant <bryant@users.noreply.github.com> Co-authored-by: Michael Lingelbach <m.j.lbach@gmail.com> Co-authored-by: nlueb <9465658+nlueb@users.noreply.github.com> Co-authored-by: Leonhard Saam <leonhard.saam@yahoo.com> Co-authored-by: Jesse Wertheim <jaawerth@gmail.com> Co-authored-by: dm1try <me@dmitry.it> Co-authored-by: Jakub Łuczyński <doubleloop@o2.pl> Co-authored-by: Louis Lebrault <louis.lebrault@gmail.com>
* feat(diagnostic)!: make DiagnosticChanged a first class autocmd (#16098)Gregory Anders2021-11-25
| | | | | | | This allows users to hook into diagnostic events with finer granularity (e.g. per-buffer or file). BREAKING CHANGE: DiagnosticsChanged and LspDiagnosticsChanged user autocommands are removed.