aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/diagnostic.lua
Commit message (Collapse)AuthorAge
...
* feat(diagnostic): add support for many namespaces filtering in GetOpts (#28045)Mayrom2024-03-26
|
* docs: support inline markdownLewis Russell2024-03-09
| | | | | | - Tags are now created with `[tag]()` - References are now created with `[tag]` - Code spans are no longer wrapped
* docs(lua): improvements for LSP and DiagnosticLewis Russell2024-03-05
|
* docs: improve/add documentation of Lua typesLewis Russell2024-03-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Added `@inlinedoc` so single use Lua types can be inlined into the functions docs. E.g. ```lua --- @class myopts --- @inlinedoc --- --- Documentation for some field --- @field somefield integer --- @param opts myOpts function foo(opts) end ``` Will be rendered as ``` foo(opts) Parameters: - {opts} (table) Object with the fields: - somefield (integer) Documentation for some field ``` - Marked many classes with with `@nodoc` or `(private)`. We can eventually introduce these when we want to.
* feat(docs): replace lua2dox.luaLewis Russell2024-02-27
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: The documentation flow (`gen_vimdoc.py`) has several issues: - it's not very versatile - depends on doxygen - doesn't work well with Lua code as it requires an awkward filter script to convert it into pseudo-C. - The intermediate XML files and filters makes it too much like a rube goldberg machine. Solution: Re-implement the flow using Lua, LPEG and treesitter. - `gen_vimdoc.py` is now replaced with `gen_vimdoc.lua` and replicates a portion of the logic. - `lua2dox.lua` is gone! - No more XML files. - Doxygen is now longer used and instead we now use: - LPEG for comment parsing (see `scripts/luacats_grammar.lua` and `scripts/cdoc_grammar.lua`). - LPEG for C parsing (see `scripts/cdoc_parser.lua`) - Lua patterns for Lua parsing (see `scripts/luacats_parser.lua`). - Treesitter for Markdown parsing (see `scripts/text_utils.lua`). - The generated `runtime/doc/*.mpack` files have been removed. - `scripts/gen_eval_files.lua` now instead uses `scripts/cdoc_parser.lua` directly. - Text wrapping is implemented in `scripts/text_utils.lua` and appears to produce more consistent results (the main contributer to the diff of this change).
* fix(lsp): send back diagnostic tags to the serverLewis Russell2024-02-06
| | | | Fixes: #27318
* docs: small fixes (#27213)dundargoc2024-02-06
| | | Co-authored-by: Matthieu Coudron <886074+teto@users.noreply.github.com>
* refactor: create function for deferred loadingdundargoc2024-02-03
| | | | | | | | | | | | | | | | The benefit of this is that users only pay for what they use. If e.g. only `vim.lsp.buf_get_clients()` is called then they don't need to load all modules under `vim.lsp` which could lead to significant startuptime saving. Also `vim.lsp.module` is a bit nicer to user compared to `require("vim.lsp.module")`. This isn't used for some nested modules such as `filetype` as it breaks tests with error messages such as "attempt to index field 'detect'". It's not entirely certain the reason for this, but it is likely it is due to filetype being precompiled which would imply deferred loading isn't needed for performance reasons.
* fix(diagnostic): fix typing on field |diagnostic-severity|Jongwook Choi2024-01-23
| | | | | | | | Problem: vim.diagnostic.{underline,float,virtual_text...}.severity will have a type warning on list-like or table (min-max) inputs, e.g. `vim.diagnostic.config { float = { severity = { min = INFO } } }`. Solution: Correct the typing as documented in |diagnostic-severity|.
* fix(lua): return after assert returns assert message (#27064)altermo2024-01-17
|
* fix(diagnostic): typingLewis Russell2024-01-16
|
* feat(lua): add noref to deepcopyLewis Russell2024-01-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Currently `deepcopy` hashes every single tables it copies so it can be reused. For tables of mostly unique items that are non recursive, this hashing is unnecessarily expensive Solution: Port the `noref` argument from Vimscripts `deepcopy()`. The below benchmark demonstrates the results for two extreme cases of tables of different sizes. One table that uses the same table lots of times and one with all unique tables. | test | `noref=false` (ms) | `noref=true` (ms) | | -------------------- | ------------------ | ----------------- | | unique tables (50) | 6.59 | 2.62 | | shared tables (50) | 3.24 | 6.40 | | unique tables (2000) | 23381.48 | 2884.53 | | shared tables (2000) | 3505.54 | 14038.80 | The results are basically the inverse of each other where `noref` is much more performance on tables with unique fields, and `not noref` is more performant on tables that reuse fields.
* 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: fix luals warningsdundargoc2023-12-30
|
* refactor: use vim.deprecate on all deprecated functionsdundargoc2023-12-27
|
* 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.
* docs(diagnostic): add return value of `vim.diagnostic.config()` (#26615)Yi Ming2023-12-17
|
* refactor(diagnostic): use named namespaces (#26568)Gregory Anders2023-12-14
| | | | | Anonymous namespaces are more difficult to extend or hook into since they do not appear in the output of nvim_get_namespaces(). Use named namespaces instead.
* feat(diagnostics): support numhl and linehl for diagnostic signsGregory Anders2023-12-13
|
* docs(diagnostic): fix typo in exampleGregory Anders2023-12-13
|
* 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(diagnostics): if buffer not loaded, skip handlers that set extmark (#25628)Jaehwang Jung2023-10-16
| | | | | | | | | | Problem: When enabling diagnostics, there can be diagnostics for unloaded buffer, but some handlers nevertheless attempt to set extmarks in such buffers. Solution: * Exit underline/virtual_text handler if buffer is not loaded. * Don't require is_loaded as precondition for show(), because handlers don't necessarily depend on it.
* docs: replace <pre> with ``` (#25136)Gregory Anders2023-09-14
|
* 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): provide more control over virtual text display (#24724)Gregory Anders2023-08-16
| | | | | | Allow users to pass virtual text options to nvim_buf_set_extmark through the "virtual_text" table in vim.diagnostic.config(). Fixes: https://github.com/neovim/neovim/issues/16545
* fix(lua): improve annotations for stricter luals diagnostics (#24609)Christian Clason2023-08-09
| | | | | | | | | | | | | | | Problem: luals returns stricter diagnostics with bundled luarc.json Solution: Improve some function and type annotations: * use recognized uv.* types * disable diagnostic for global `vim` in shared.lua * docs: don't start comment lines with taglink (otherwise LuaLS will interpret it as a type) * add type alias for lpeg pattern * fix return annotation for `vim.secure.trust` * rename local Range object in vim.version (shadows `Range` in vim.treesitter) * fix some "missing fields" warnings * add missing required fields for test functions in eval.lua * rename lsp meta files for consistency
* docs(lua): more improvements (#24387)Lewis Russell2023-07-18
| | | | | | | | | | | | | | | | | * docs(lua): teach lua2dox how to table * docs(lua): teach gen_vimdoc.py about local functions No more need to mark local functions with @private * docs(lua): mention @nodoc and @meta in dev-lua-doc * fixup! Co-authored-by: Justin M. Keyes <justinkz@gmail.com> --------- Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
* docs(diagnostic): return value of get() #24144NAKAI Tsuyoshi2023-06-27
|
* 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.
* fix(diagnostic): rename buffer → bufnr in type annotation (#23042)Mathias Fußenegger2023-04-12
| | | | See `:h diagnostic-structure`, the property name is `bufnr`, not `buffer`.
* 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.
* docs(diagnostic): number → integer (#22512)Jaehwang Jung2023-03-04
|
* 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
|