diff options
author | Gregory Anders <8965202+gpanders@users.noreply.github.com> | 2021-09-22 13:20:15 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-22 12:20:15 -0700 |
commit | d999c96cf3146d4181d5493aa5da94f738dec9d8 (patch) | |
tree | 0bf611e834d9855a7349b5a8ad29f4eb72428ff7 /runtime/doc | |
parent | 80e3f0eb340bb3f14b1f7db9178d61e08364da11 (diff) | |
download | rneovim-d999c96cf3146d4181d5493aa5da94f738dec9d8.tar.gz rneovim-d999c96cf3146d4181d5493aa5da94f738dec9d8.tar.bz2 rneovim-d999c96cf3146d4181d5493aa5da94f738dec9d8.zip |
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.
Diffstat (limited to 'runtime/doc')
-rw-r--r-- | runtime/doc/diagnostic.txt | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt index c0ae6a5a1a..68e4353d5b 100644 --- a/runtime/doc/diagnostic.txt +++ b/runtime/doc/diagnostic.txt @@ -230,6 +230,18 @@ config({opts}, {namespace}) *vim.diagnostic.config()* • source: (string) Include the diagnostic source in virtual text. One of "always" or "if_many". + • format: (function) A function that takes + a diagnostic as input and returns a + string. The return value is the text used + to display the diagnostic. Example:> + + function(diagnostic) + if diagnostic.severity == vim.diagnostic.severity.ERROR then + return string.format("E: %s", diagnostic.message) + end + return diagnostic.message + end +< • signs: (default true) Use signs for diagnostics. Options: @@ -519,6 +531,10 @@ show_position_diagnostics({opts}, {bufnr}, {position}) • source: (string) Include the diagnostic source in the message. One of "always" or "if_many". + • format: (function) A function that takes a + diagnostic as input and returns a string. + The return value is the text used to display + the diagnostic. {bufnr} number|nil Buffer number. Defaults to the current buffer. {position} table|nil The (0,0)-indexed position. Defaults |