aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/diagnostic_spec.lua
Commit message (Collapse)AuthorAge
* feat(diagnostic): add `current_line` option for `virtual_text` handlerMaria José Solano2025-02-05
|
* feat(diagnostic): format() can filter diagnostics by returning nil #32302Maria José Solano2025-02-03
|
* feat(diagnostic): virtual_lines #31959Maria José Solano2025-01-26
|
* fix(diagnostic)!: make virtual text handler opt-in (#32079)Gregory Anders2025-01-18
| | | | | | | | | | | Making this opt-out (on by default) was the wrong choice from the beginning. It is too visually noisy to be enabled by default. BREAKING CHANGE: Users must opt-in to the diagnostic virtual text handler by adding vim.diagnostic.config({ virtual_text = true }) to their config.
* fix(diagnostic): vim.diagnostic.setqflist() opens loclist on first call #31585Juan Cruz De La Torre2024-12-16
| | | | | | | | | | | | Problem: Regression from de794f2d2409: `vim.diagnostic.setqflist{open=true}` attempts to open the location list instead of the diagnostics quickfix list if it didn't exist before. This is because we are using `qf_id` to decide which to open, but `qf_id=nil` when there is no existing diagnostics quickfix list with a given title ("Diagnostics" by default). Solution: - Revert to using `loclist` to decide which to open. - Add tests.
* feat(diagnostics)!: sort underline severity_sort (#30898)Donatas2024-10-27
| | | | | feat(diagnostics)!: sort underline with severity_sort BREAKING CHANGE: underline will be applied with a higher value than `vim.hl.priorities.diagnostics`
* test: support upvalues in exec_luaLewis Russell2024-09-21
|
* test: allow exec_lua to handle functionsLewis Russell2024-08-02
| | | | | | | | | | | Problem: Tests have lots of exec_lua calls which input blocks of code provided as unformatted strings. Solution: Teach exec_lua how to handle functions.
* fix(diagnostic): fix float scope filtering (#29134)Andre Toerien2024-06-04
|
* feat(defaults): use vim.diagnostic.jump() for default mappings (#29066)Gregory Anders2024-05-28
| | | | This allows the mappings to work with a count and also enables new ]D and [D mappings to go to the last/first diagnostic in the buffer.
* feat(diagnostic): add vim.diagnostic.jump() (#26745)Gregory Anders2024-05-28
| | | | | | | | | | | | Deprecate vim.diagnostic.goto_prev() and vim.diagnostic.goto_next() in favor of a unified vim.diagnostic.jump() interface. We cannot name the function "goto()" because some of our tooling (luacheck and stylua) fail to parse it, presumably because "goto" is a keyword in newer versions of Lua. vim.diagnostic.jump() also allows moving to a specific diagnostic and moving by multiple diagnostics at a time (useful for creating mappings that use v:count).
* feat(diagnostic): revert default behaviour of goto_next/prev()Lewis Russell2024-04-30
| | | | | | | | | | | | | | | | | Follow-up to #28490 Problem: The new behaviour of goto_next/prev() of navigating to the next highest severity doesn't work well when diagnostic providers have different interpretations of severities. E.g. the user may be blocked from navigating to a useful LSP warning, due to some linter error. Solution: The behaviour of next highest severity is now a hidden option `_highest = true`. We can revisit how to integrate this behaviour during the 0.11 cycle.
* fix(diagnostic): invalid col number compare in next_diagnostic (#28397)Raphael2024-04-27
| | | | | Problem: when line is blank link then there will got an invalid column number in math.min compare. Solution: make sure the min column number is 0 not an illegal number.
* feat(diagnostic): goto functions jump to highest severity (#28490)Gregory Anders2024-04-25
| | | | | When the "severity" option is nil, vim.diagnostic.goto_next() and vim.diagnostic.goto_prev() jump to the next diagnostic with the highest severity.
* test: improve test conventionsdundargoc2024-04-23
| | | | | | | | | Specifically, functions that are run in the context of the test runner are put in module `test/testutil.lua` while the functions that are run in the context of the test session are put in `test/functional/testnvim.lua`. Closes https://github.com/neovim/neovim/issues/27004.
* fix(diagnostic): vim.diagnostic.get(…,{lnum=…}) on multi-line diagnostic ↵Raphael2024-04-23
| | | | | | | | #28273 Problem: vim.diagnostic.get(…,{lnum=…}) does not match multi-line diagnostics. Solution: add end_lnum support.
* fix(diagnostic): open_float on multi-line diagnostics #28301Raphael2024-04-23
| | | | | Problem: when diagnostic have a range of line, open_float not work. Solution: filter diagnostic by line number range.
* feat(lua): enable(enable:boolean, filter:table) #28374Justin M. Keyes2024-04-18
| | | | | | | | | | | | | Problem: We need to establish a pattern for `enable()`. Solution: - First `enable()` parameter is always `enable:boolean`. - Update `vim.diagnostic.enable()` - Update `vim.lsp.inlay_hint.enable()`. - It was not released yet, so no deprecation is needed. But to help HEAD users, it will show an informative error. - vim.deprecate(): - Improve message when the "removal version" is a *current or older* version.
* feat(diagnostic): enable(…, opts)Justin M. Keyes2024-04-15
| | | | | | | | | | Problem: vim.diagnostic.enable() does not match the signature of vim.lsp.inlay_hint.enable() Solution: - Change the signature so that the first 2 args are (bufnr, enable). - Introduce a 3rd `opts` arg. - Currently it only supports `opts.ns_id`.
* feat(diagnostic): is_enabled, enable(…, enable:boolean)Justin M. Keyes2024-04-15
| | | | | | | | | | | | | | | | | | | | Problem: `vim.diagnostic.is_disabled` and `vim.diagnostic.disable` are unnecessary and inconsistent with the "toggle" pattern (established starting with `vim.lsp.inlay_hint`, see https://github.com/neovim/neovim/pull/25512#pullrequestreview-1676750276 As a reminder, the rationale is: - we always need `enable()` - we always end up needing `is_enabled()` - "toggle" can be achieved via `enable(not is_enabled())` - therefore, - `toggle()` and `disable()` are redundant - `is_disabled()` is a needless inconsistency Solution: - Introduce `vim.diagnostic.is_enabled`, and `vim.diagnostic.enable(…, enable:boolean)` - Note: Future improvement would be to add an `enable()` overload `enable(enable:boolean, opts: table)`. - Deprecate `vim.diagnostic.is_disabled`, `vim.diagnostic.disable`
* refactor(test): inject after_each differentlyLewis Russell2024-04-10
|
* test: improve test conventionsdundargoc2024-04-08
| | | | Work on https://github.com/neovim/neovim/issues/27004.
* test: reduce `exec_lua` callsdundargoc2024-04-04
| | | | | | | | | | | | | | | | | | | | | `exec_lua` makes code slighly harder to read, so it's beneficial to remove it in cases where it's possible or convenient. Not all `exec_lua` calls should be removed even if the test passes as it changes the semantics of the test even if it happens to pass. From https://github.com/neovim/neovim/pull/28155#discussion_r1548185779: "Note for tests like this, which fundamentally are about conversion, you end up changing what conversion you are testing. Even if the result happens to be same (as they often are, as we like the rules to be consistent if possible), you are now testing the RPC conversion rules instead of the vim script to in-process lua conversion rules." From https://github.com/neovim/neovim/pull/28155#discussion_r1548190152: "A test like this specifies that the cursor is valid immediately and not after a separate cycle of normal (or an other input-processing) mode."
* test: correct order of arguments to eq() (#27816)zeertzjq2024-03-11
|
* test: rename (meths, funcs) -> (api, fn)Lewis Russell2024-01-12
|
* test: normalise nvim bridge functionsLewis Russell2024-01-12
| | | | | - remove helpers.cur*meths - remove helpers.nvim
* test: do not inject vim module into global helpersLewis Russell2024-01-12
|
* refactor: format test/*Justin M. Keyes2024-01-03
|
* feature(diagnostic): add `vim.diagnostic.count()` (#26807)Evgeni Chasnovski2024-01-01
| | | | | | | | | | | | | feat(diagnostic): add `vim.diagnostic.count()` Problem: Getting diagnostic count based on the output of `vim.diagnostic.get()` might become costly as number of diagnostic entries grows. This is because it returns a copy of diagnostic cache entries (so as to not allow users to change them in place). Getting information about diagnostic count is frequently used in statusline, so it is important to be as fast as reasonbly possible. Solution: Add `vim.diagnostic.count()` which computes severity counts without making copies.
* refactor: soft-deprecate diagnostic signs configured with :sign-define (#26618)Gregory Anders2023-12-18
| | | | | Diagnostic signs should now be configured with vim.diagnostic.config(), but "legacy" sign definitions should go through the standard deprecation process to minimize the impact from breaking changes.
* fix(diagnostic): check for sign namespace instead of sign groupGregory Anders2023-12-13
|
* refactor(diagnostic): set sign by using extmark (#26193)Raphael2023-12-13
| | | | after sign implementation refactor by using extmark, we can use `nvim_buf_set_extmark` to set diagnostic sign instead use `sign_define`
* fix(diagnostic): virtual_text prefix function should have index and total ↵Jongwook Choi2023-10-27
| | | | | | | | | | | | | (#25801) The prefix option of the diagnostic virtual text can be a function, but previously it was only a function of diagnostic. This function should also have additional parameters index and total, more consistently and similarily as in the prefix function for `vim.diagnostic.open_float()`. These additional parameters will be useful when there are too many number of diagnostics in a single line.
* fix(diagnostic): always return copies of diagnostic items (#25010)Evgeni Chasnovski2023-09-06
|
* feat(diagnostic): filter diagnostics by specific severities (#24736)Michael Strobel2023-08-16
| | | Allow users to filter diagnostics by specifying severities
* feat(diagnostic): specify diagnostic virtual text prefix as a functionIsak Samsten2023-04-17
| | | | - vim.diagnostic.config() now accepts a function for the virtual_text.prefix option, which allows for rendering e.g., diagnostic severities differently.
* test(lua/diagnostic_spec): remove unnecessary after_each()zeertzjq2023-04-07
| | | There is already a call to clear() in before_each(), so after_each() isn't necessary.
* feat(diagnostic): add support for tagsLewis Russell2023-03-30
| | | | | | The LSP spec supports two tags that can be added to diagnostics: unnecessary and deprecated. Extend vim.diagnostic to be able to handle these.
* feat(diagnostic): vim.diagnostic.is_disabled() #21527Raphael2023-01-12
|
* feat(highlight): add DiagnosticOk (and associated) highlight groups (#21286)Oliver Marriott2022-12-28
| | | | | | The existing groups, Error, Hint, Info, Warn cover many use cases, but neglect the occasion where a diagnostic message should communicate a non-informative (not a Hint or Info) event. DiagnosticOk covers this with a generic green colorscheme.
* 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'
* 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
* feat(test): add Lua forms for API methods (#20152)Lewis Russell2022-11-14
|
* 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>
* fix(diagnostic): check for negative column value (#18868)mohsen2022-06-08
|
* 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.