aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
authorGregory Anders <greg@gpanders.com>2023-12-13 09:54:04 -0600
committerGregory Anders <greg@gpanders.com>2023-12-13 09:56:10 -0600
commita3b39784744f330b922117655811542202fcd85b (patch)
tree0b037930301781f91d117abcbb240e5c35160284 /runtime/lua/vim
parent39112c72dd3722cd4a0770fc23c9d7269a9c2283 (diff)
downloadrneovim-a3b39784744f330b922117655811542202fcd85b.tar.gz
rneovim-a3b39784744f330b922117655811542202fcd85b.tar.bz2
rneovim-a3b39784744f330b922117655811542202fcd85b.zip
feat(diagnostics): support numhl and linehl for diagnostic signs
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/diagnostic.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua
index 1d76d1d7a0..0eb1ac7f15 100644
--- a/runtime/lua/vim/diagnostic.lua
+++ b/runtime/lua/vim/diagnostic.lua
@@ -602,6 +602,10 @@ end
--- signs = { text = { [vim.diagnostic.severity.ERROR] = 'E', ... } }
--- })
--- </pre>
+--- * numhl: (table) A table mapping |diagnostic-severity| to the highlight
+--- group used for the line number where the sign is placed.
+--- * linehl: (table) A table mapping |diagnostic-severity| to the highlight group
+--- used for the whole line the sign is placed in.
--- - float: Options for floating windows. See |vim.diagnostic.open_float()|.
--- - update_in_insert: (default false) Update diagnostics in Insert mode (if false,
--- diagnostics are updated on InsertLeave)
@@ -885,11 +889,16 @@ M.handlers.signs = {
end
end
+ local numhl = opts.signs.numhl or {}
+ local linehl = opts.signs.linehl or {}
+
for _, diagnostic in ipairs(diagnostics) do
if api.nvim_buf_is_loaded(diagnostic.bufnr) then
api.nvim_buf_set_extmark(bufnr, ns.user_data.sign_ns, diagnostic.lnum, 0, {
sign_text = text[diagnostic.severity] or text[M.severity[diagnostic.severity]] or 'U',
sign_hl_group = sign_highlight_map[diagnostic.severity],
+ number_hl_group = numhl[diagnostic.severity],
+ line_hl_group = linehl[diagnostic.severity],
priority = get_priority(diagnostic.severity),
})
end