mirror of
https://github.com/neovim/neovim.git
synced 2025-10-10 03:46:31 +00:00
fix(diagnostic): respect "if_many" source option for virtual text (#16697)
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".
This commit is contained in:
![41898282+github-actions[bot]@users.noreply.github.com](/assets/img/avatar_default.png)
committed by
GitHub

parent
9dae939b1f
commit
060eeaa14c
@@ -345,9 +345,12 @@ config({opts}, {namespace}) *vim.diagnostic.config()*
|
||||
• severity: Only show virtual text for
|
||||
diagnostics matching the given severity
|
||||
|diagnostic-severity|
|
||||
• source: (string) Include the diagnostic
|
||||
source in virtual text. One of "always"
|
||||
or "if_many".
|
||||
• source: (boolean or string) Include the
|
||||
diagnostic source in virtual text. Use
|
||||
"if_many" to only show sources if there
|
||||
is more than one diagnostic source in the
|
||||
buffer. Otherwise, any truthy value means
|
||||
to always show the diagnostic source.
|
||||
• format: (function) A function that takes
|
||||
a diagnostic as input and returns a
|
||||
string. The return value is the text used
|
||||
@@ -606,9 +609,12 @@ open_float({opts}, {...}) *vim.diagnostic.open_float()*
|
||||
is interpreted as a [text, hl_group] tuple.
|
||||
Overrides the setting from
|
||||
|vim.diagnostic.config()|.
|
||||
• source: (string) Include the diagnostic source
|
||||
in the message. One of "always" or "if_many".
|
||||
Overrides the setting from
|
||||
• source: (boolean or string) Include the
|
||||
diagnostic source in the message. Use "if_many"
|
||||
to only show sources if there is more than one
|
||||
source of diagnostics in the buffer. Otherwise,
|
||||
any truthy value means to always show the
|
||||
diagnostic source. Overrides the setting from
|
||||
|vim.diagnostic.config()|.
|
||||
• format: (function) A function that takes a
|
||||
diagnostic as input and returns a string. The
|
||||
|
Reference in New Issue
Block a user