mirror of
https://github.com/neovim/neovim.git
synced 2026-08-27 09:31:47 +00:00
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.
This commit is contained in:
@@ -384,17 +384,24 @@ config({opts}, {namespace}) *vim.diagnostic.config()*
|
||||
a diagnostic as input and returns a
|
||||
string. The return value is the text used
|
||||
to display the diagnostic.
|
||||
• prefix: (function or string) Prefix each
|
||||
diagnostic in the floating window. If a
|
||||
function, it must have the signature
|
||||
(diagnostic, i, total) -> string, where
|
||||
{i} is the index of the diagnostic being
|
||||
evaluated and {total} is the total number
|
||||
of diagnostics displayed in the window.
|
||||
The returned string is prepended to each
|
||||
diagnostic in the window. Otherwise, if
|
||||
• prefix: (function, string, or table)
|
||||
Prefix each diagnostic in the floating
|
||||
window. If a function, it must have the
|
||||
signature (diagnostic, i, total) ->
|
||||
(string, string), where {i} is the index
|
||||
of the diagnostic being evaluated and
|
||||
{total} is the total number of
|
||||
diagnostics displayed in the window. The
|
||||
function should return a string which is
|
||||
prepended to each diagnostic in the
|
||||
window as well as an (optional) highlight
|
||||
group which will be used to highlight the
|
||||
prefix. If {prefix} is a table, it is
|
||||
interpreted as a [text, hl_group] tuple
|
||||
as in |nvim_echo()|; otherwise, if
|
||||
{prefix} is a string, it is prepended to
|
||||
each diagnostic.
|
||||
each diagnostic in the window with no
|
||||
highlight.
|
||||
|
||||
• update_in_insert: (default false) Update
|
||||
diagnostics in Insert mode (if false,
|
||||
@@ -625,9 +632,10 @@ open_float({bufnr}, {opts}) *vim.diagnostic.open_float()*
|
||||
return value is the text used to display the
|
||||
diagnostic. Overrides the setting from
|
||||
|vim.diagnostic.config()|.
|
||||
• prefix: (function or string) Prefix each
|
||||
diagnostic in the floating window. Overrides
|
||||
the setting from |vim.diagnostic.config()|.
|
||||
• prefix: (function, string, or table) Prefix
|
||||
each diagnostic in the floating window.
|
||||
Overrides the setting from
|
||||
|vim.diagnostic.config()|.
|
||||
|
||||
Return: ~
|
||||
tuple ({float_bufnr}, {win_id})
|
||||
|
||||
Reference in New Issue
Block a user