diff options
author | Gregory Anders <8965202+gpanders@users.noreply.github.com> | 2023-08-16 08:21:32 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-16 08:21:32 -0500 |
commit | 9cb7e00b9748b08fce661f8cbeb06c5994c749ae (patch) | |
tree | 38928060dd252fffa8b765492d1977b5a25b19c3 /runtime/lua/vim/diagnostic.lua | |
parent | 54be7d6b45a9ae51c218c0e5c1c20dd608b97297 (diff) | |
download | rneovim-9cb7e00b9748b08fce661f8cbeb06c5994c749ae.tar.gz rneovim-9cb7e00b9748b08fce661f8cbeb06c5994c749ae.tar.bz2 rneovim-9cb7e00b9748b08fce661f8cbeb06c5994c749ae.zip |
feat(diagnostic): provide more control over virtual text display (#24724)
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
Diffstat (limited to 'runtime/lua/vim/diagnostic.lua')
-rw-r--r-- | runtime/lua/vim/diagnostic.lua | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua index 180b9ad3df..1391dafd75 100644 --- a/runtime/lua/vim/diagnostic.lua +++ b/runtime/lua/vim/diagnostic.lua @@ -566,7 +566,9 @@ end --- severity |diagnostic-severity| --- - virtual_text: (default true) Use virtual text for diagnostics. If multiple diagnostics --- are set for a namespace, one prefix per diagnostic + the last diagnostic ---- message are shown. +--- message are shown. In addition to the options listed below, the +--- "virt_text" options of |nvim_buf_set_extmark()| may also be used here +--- (e.g. "virt_text_pos" and "hl_mode"). --- Options: --- * severity: Only show virtual text for diagnostics matching the given --- severity |diagnostic-severity| @@ -1008,8 +1010,11 @@ M.handlers.virtual_text = { if virt_texts then api.nvim_buf_set_extmark(bufnr, virt_text_ns, line, 0, { - hl_mode = 'combine', + hl_mode = opts.virtual_text.hl_mode or 'combine', virt_text = virt_texts, + virt_text_pos = opts.virtual_text.virt_text_pos, + virt_text_hide = opts.virtual_text.virt_text_hide, + virt_text_win_col = opts.virtual_text.virt_text_win_col, }) end end |