aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/diagnostic.lua
diff options
context:
space:
mode:
authorThomas Vigouroux <tomvig38@gmail.com>2021-08-04 09:28:38 +0200
committerGitHub <noreply@github.com>2021-08-04 09:28:38 +0200
commit3d183596720aeab874ceb475af23e390bbe9b8a3 (patch)
tree4c9c1c645b6881941fe70e565c0a0a4a51380354 /runtime/lua/vim/lsp/diagnostic.lua
parent545e05d2fe98683494eb972e2661e348f2c0c290 (diff)
parent2093b12b82cfe0d982c092141fd77695c98b59f3 (diff)
downloadrneovim-3d183596720aeab874ceb475af23e390bbe9b8a3.tar.gz
rneovim-3d183596720aeab874ceb475af23e390bbe9b8a3.tar.bz2
rneovim-3d183596720aeab874ceb475af23e390bbe9b8a3.zip
Merge pull request #15257 from gpanders/remove-set_virtual_text
refactor: remove remaining references to nvim_buf_set_virtual_text
Diffstat (limited to 'runtime/lua/vim/lsp/diagnostic.lua')
-rw-r--r--runtime/lua/vim/lsp/diagnostic.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua
index 120320becc..5efd8d74a7 100644
--- a/runtime/lua/vim/lsp/diagnostic.lua
+++ b/runtime/lua/vim/lsp/diagnostic.lua
@@ -766,17 +766,20 @@ function M.set_virtual_text(diagnostics, bufnr, client_id, diagnostic_ns, opts)
local virt_texts = M.get_virtual_text_chunks_for_line(bufnr, line, line_diagnostics, opts)
if virt_texts then
- api.nvim_buf_set_virtual_text(bufnr, diagnostic_ns, line, virt_texts, {})
+ api.nvim_buf_set_extmark(bufnr, diagnostic_ns, line, 0, {
+ virt_text = virt_texts,
+ })
end
end
end
---- Default function to get text chunks to display using `nvim_buf_set_virtual_text`.
+--- Default function to get text chunks to display using |nvim_buf_set_extmark()|.
---@param bufnr number The buffer to display the virtual text in
---@param line number The line number to display the virtual text on
---@param line_diags Diagnostic[] The diagnostics associated with the line
---@param opts table See {opts} from |vim.lsp.diagnostic.set_virtual_text()|
----@return table chunks, as defined by |nvim_buf_set_virtual_text()|
+---@return an array of [text, hl_group] arrays. This can be passed directly to
+--- the {virt_text} option of |nvim_buf_set_extmark()|.
function M.get_virtual_text_chunks_for_line(bufnr, line, line_diags, opts)
assert(bufnr or line)