aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/diagnostic.lua
diff options
context:
space:
mode:
authorRaphael <glephunter@gmail.com>2024-04-23 19:06:41 +0800
committerGitHub <noreply@github.com>2024-04-23 04:06:41 -0700
commitad76b050eb2cd03174c108b5ae6759b3c1ea8941 (patch)
tree460fb0e7ab07ea66a85dac0c6c509461b81d9042 /runtime/lua/vim/diagnostic.lua
parentaef120d1e94e83a367a631d6bc8ce0b4a64f9dbd (diff)
downloadrneovim-ad76b050eb2cd03174c108b5ae6759b3c1ea8941.tar.gz
rneovim-ad76b050eb2cd03174c108b5ae6759b3c1ea8941.tar.bz2
rneovim-ad76b050eb2cd03174c108b5ae6759b3c1ea8941.zip
fix(diagnostic): open_float on multi-line diagnostics #28301
Problem: when diagnostic have a range of line, open_float not work. Solution: filter diagnostic by line number range.
Diffstat (limited to 'runtime/lua/vim/diagnostic.lua')
-rw-r--r--runtime/lua/vim/diagnostic.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua
index 5e4835ab88..7371b5241f 100644
--- a/runtime/lua/vim/diagnostic.lua
+++ b/runtime/lua/vim/diagnostic.lua
@@ -1697,7 +1697,7 @@ function M.open_float(opts, ...)
if scope == 'line' then
--- @param d vim.Diagnostic
diagnostics = vim.tbl_filter(function(d)
- return d.lnum == lnum
+ return lnum >= d.lnum and lnum <= d.end_lnum
end, diagnostics)
elseif scope == 'cursor' then
-- LSP servers can send diagnostics with `end_col` past the length of the line