aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2021-09-17 04:58:31 -0700
committerGitHub <noreply@github.com>2021-09-17 04:58:31 -0700
commitc4b774470422a5c6849cbd89bc5464b790391ad8 (patch)
treed7e7c107734b8effe4949c5de20a0758c1105b36
parent4881456e83fb49994677fe06aef3b0c597ba4517 (diff)
parent22d146760e136152b3fe72bdd7ae982f43f2751b (diff)
downloadrneovim-c4b774470422a5c6849cbd89bc5464b790391ad8.tar.gz
rneovim-c4b774470422a5c6849cbd89bc5464b790391ad8.tar.bz2
rneovim-c4b774470422a5c6849cbd89bc5464b790391ad8.zip
Merge #15693 fix(diagnostics)
fix(diagnostics): fixup for `show_line_diagnostics` and `lsp.diagnostics.get`
-rw-r--r--runtime/lua/vim/diagnostic.lua6
-rw-r--r--runtime/lua/vim/lsp/diagnostic.lua2
2 files changed, 4 insertions, 4 deletions
diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua
index 893d0d5cb7..688f9b5811 100644
--- a/runtime/lua/vim/diagnostic.lua
+++ b/runtime/lua/vim/diagnostic.lua
@@ -523,7 +523,7 @@ end
--- Get current diagnostics.
---
----@param bufnr number|nil Buffer number to get diagnistics from. Use 0 for
+---@param bufnr number|nil Buffer number to get diagnostics from. Use 0 for
--- current buffer or nil for all buffers.
---@param opts table|nil A table with the following keys:
--- - namespace: (number) Limit diagnostics to the given namespace.
@@ -1001,7 +1001,7 @@ end
--- Open a floating window with the diagnostics at the given position.
---
---@param opts table|nil Configuration table with the same keys as
---- |vim.lsp.util.open_floatin_preview()| in addition to the following:
+--- |vim.lsp.util.open_floating_preview()| in addition to the following:
--- - namespace: (number) Limit diagnostics to the given namespace
--- - severity: See |diagnostic-severity|.
--- - show_header: (boolean, default true) Show "Diagnostics:" header
@@ -1049,7 +1049,7 @@ function M.show_line_diagnostics(opts, bufnr, lnum)
opts = opts or {}
opts.focus_id = "line_diagnostics"
- opts.lnum = lnum
+ opts.lnum = lnum or (vim.api.nvim_win_get_cursor(0)[1] - 1)
local line_diagnostics = M.get(bufnr, opts)
return show_diagnostics(opts, line_diagnostics)
end
diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua
index 48c0dd92cb..eef840bee5 100644
--- a/runtime/lua/vim/lsp/diagnostic.lua
+++ b/runtime/lua/vim/lsp/diagnostic.lua
@@ -265,7 +265,7 @@ function M.get(bufnr, client_id, predicate)
table.insert(all_diagnostics, diagnostic)
end
end)
- return diagnostic_vim_to_lsp(all_diagnostics)
+ return all_diagnostics
end
local namespace = M.get_namespace(client_id)