Commit Graph

39 Commits

Author SHA1 Message Date
dundargoc
c815aadfcc
docs: fix typos (#20150)
Co-authored-by: Miguel Carneiro <mcarneiromorenas@gmail.com>
Co-authored-by: Gregory Anders <greg@gpanders.com>
Co-authored-by: Raphael <glephunter@gmail.com>
Co-authored-by: C.D. MacEachern <craig.daniel.maceachern@gmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-09-26 17:43:23 +08:00
Gregory Anders
1970d2ac43
feat(diagnostic): pass diagnostics as data to DiagnosticChanged autocmd (#20173) 2022-09-13 08:33:39 -06:00
ii14
ea333badd2 docs: regenerate 2022-08-11 14:25:48 +02:00
dundargoc
abc087f4c6
docs: fix typos (#19024)
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: Valery Viktorovsky <viktorovsky@gmail.com>
2022-07-31 16:46:38 +08:00
dundargoc
a1b663cce8
build(lua2dox): add parenthesis around parameter types in documentation (#18532)
This will check if the string after the variable in a @param is either
"number", "string", "table", "boolean" and "function" and if so add a
parenthesis around it. This will help separate the variable type with
the following text. Had all our functions been annotated with emmylua
then a more robust solution might have been preferable (such as always
assuming the third string is parameter type without making any checks).
I believe however this is a clear improvement over the current situation
and will suffice for now.
2022-05-12 08:02:46 -06:00
Daiki Mizukami
ecc36c3d1c
docs: remove extra whitespaces 2022-03-14 08:16:01 +09:00
dundargoc
a7b1c8893c
chore: fix typos (#17331)
Co-authored-by: Hongyi Lyu <hongyi.lyu95@gmail.com>
Co-authored-by: Gregory Anders <greg@gpanders.com>
Co-authored-by: notomo <notomo.motono@gmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2022-03-10 14:34:55 +08:00
David Shen
5d6006f9bf
feat(diagnostic): add "code" to the diagnostic structure (#17510) 2022-03-02 18:42:27 -07:00
Gregory Anders
c915571b99 feat(diagnostic): allow retrieving current diagnostic config 2022-01-11 16:46:42 -07:00
dundargoc
08616571f4
chore: fix typos (#16506)
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>
2021-12-28 18:15:16 +01:00
Gregory Anders
818ae74eaf
fix(diagnostic): respect "if_many" source option for virtual text (#16653)
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".
2021-12-17 19:38:33 -07:00
Mathias Fußenegger
3aff3d6349
fix(docs): add bufnr and user_data to diagnostic-structure (#16619) 2021-12-11 16:59:16 +01:00
Gregory Anders
be84529190
refactor(diagnostic): remove bufnr parameter from open_float (#16579)
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.
2021-12-08 18:44:31 -07:00
github-actions[bot]
6e70b7b31d
docs: regenerate (#16461) 2021-11-28 10:47:37 -07:00
cbarrete
217f9f8d1e
feat(diagnostic): use scope = 'line' by default for open_float() (#16456)
Closes #16453

Co-authored-by: Cédric Barreteau <cbarrete@users.noreply.github.com>
2021-11-28 09:42:29 -07:00
github-actions[bot]
b51b0aecc9
docs: regenerate (#16390)
Co-authored-by: marvim <marvim@users.noreply.github.com>
2021-11-27 11:26:49 -05:00
dundargoc
caa6992a10
chore: fix typos (#16361)
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>
2021-11-27 11:10:48 -05:00
Gregory Anders
150a5922aa
feat(diagnostic)!: make DiagnosticChanged a first class autocmd (#16098)
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.
2021-11-25 11:55:11 -07:00
Gregory Anders
8fb09bc512
Merge pull request #16328 from gpanders/diagnostic-prefix-hi 2021-11-16 08:48:26 -07:00
Gregory Anders
98af683e0f
refactor(diagnostic): make bufnr arguments consistent (#16323)
Make the bufnr argument have similar semantics across API functions;
namely, a nil value means "all buffers" while 0 means "current buffer".
This increases the flexibility of the API by allowing functions such as
enable() and disable() to apply globally or per-namespace, rather than
only on a specific buffer.
2021-11-16 08:47:49 -07:00
Gregory Anders
63413bd047 refactor(diagnostic)!: rename 'show_header' to 'header'
Rename the `show_header` option in `open_float` to simply `header` and
allow users to specify both the header string as well as the highlight
group.
2021-11-15 09:12:27 -07:00
Gregory Anders
cc48837622 feat(diagnostic): allow 'prefix' option to return highlight
Extend the 'prefix' option for `open_float` to also provide an optional
highlight group for the prefix string.
2021-11-15 09:05:40 -07:00
Gregory Anders
3c74ba4acb
feat(diagnostic): add 'prefix' option to open_float (#16321)
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.
2021-11-14 18:40:11 -07:00
Gregory Anders
953ae71fd3
feat(diagnostic): do not require namespace for hide() and show() (#16261)
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.
2021-11-09 14:33:01 -07:00
Gregory Anders
e921e98ce3
refactor(diagnostic): make display handlers generic (#16137)
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.
2021-10-29 18:47:34 -07:00
Gregory Anders
064411ea7f
refactor(diagnostic)!: replace 'show_*' functions with 'open_float' (#16057)
'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
2021-10-19 11:45:51 -06:00
Gregory Anders
d2d30dfabd
fix(diagnostic): do not override existing config settings #16043
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".
2021-10-17 07:18:35 -07:00
github-actions[bot]
59edd377d3
docs: regenerate #15545 2021-10-05 10:48:48 -07:00
Gregory Anders
1124439954 docs(diagnostic): add blurb on how to replace builtin handlers 2021-10-02 20:37:09 -06:00
Gregory Anders
36408146ad
docs(diagnostics): add "priority" option to signs table (#15860)
This feature was added in #15785, but the docs for
vim.diagnostic.config() weren't updated.
2021-10-01 19:07:55 -06:00
Gregory Anders
187e3a3b7e
refactor(diagnostic): use sign priority for severity_sort #15785
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.
2021-09-26 16:02:18 -07:00
Gregory Anders
d999c96cf3
feat(diagnostic): allow customized diagnostic messages (#15742)
Provide a 'format' option for virtual text and floating window previews
that allows the displayed text of a diagnostic to be customized.
2021-09-22 12:20:15 -07:00
Gregory Anders
bc652f148f refactor(diagnostic): remove get_virt_text_chunks()
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.
2021-09-21 18:54:28 -06:00
Gregory Anders
d43151ea0b feat(diagnostic): add option to include diagnostic source
Add an option to virtual text display and floating window previews to
include diagnostic source in the diagnostic message.
2021-09-21 18:54:26 -06:00
Gregory Anders
e61ea7772e
feat(diagnostic): match(), tolist(), fromlist() #15704
* 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()
2021-09-19 15:13:23 -07:00
Gregory Anders
938ed458e2 fix(diagnostic): change default severity_sort order
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.
2021-09-17 14:59:30 -06:00
Gregory Anders
32c0631183 fix(diagnostic): support severity_sort 2021-09-17 10:50:25 -06:00
Gregory Anders
15fbc9b69e docs(diagnostics): fix typos 2021-09-17 08:57:51 -06:00
Gregory Anders
a5bbb932f9 refactor: move vim.lsp.diagnostic to vim.diagnostic
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
2021-09-15 14:09:47 -06:00