aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/diagnostic_spec.lua
diff options
context:
space:
mode:
authorRaphael <glephunter@gmail.com>2024-04-23 19:13:58 +0800
committerGitHub <noreply@github.com>2024-04-23 04:13:58 -0700
commita4fc3bb0e68c8b078377fd9826e4cca3b4b3fdbf (patch)
tree41e1738c5cc0293acad307b3c2f55467cc523777 /test/functional/lua/diagnostic_spec.lua
parentad76b050eb2cd03174c108b5ae6759b3c1ea8941 (diff)
downloadrneovim-a4fc3bb0e68c8b078377fd9826e4cca3b4b3fdbf.tar.gz
rneovim-a4fc3bb0e68c8b078377fd9826e4cca3b4b3fdbf.tar.bz2
rneovim-a4fc3bb0e68c8b078377fd9826e4cca3b4b3fdbf.zip
fix(diagnostic): vim.diagnostic.get(…,{lnum=…}) on multi-line diagnostic #28273
Problem: vim.diagnostic.get(…,{lnum=…}) does not match multi-line diagnostics. Solution: add end_lnum support.
Diffstat (limited to 'test/functional/lua/diagnostic_spec.lua')
-rw-r--r--test/functional/lua/diagnostic_spec.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/test/functional/lua/diagnostic_spec.lua b/test/functional/lua/diagnostic_spec.lua
index 4f60a2255f..be3d55089b 100644
--- a/test/functional/lua/diagnostic_spec.lua
+++ b/test/functional/lua/diagnostic_spec.lua
@@ -1076,13 +1076,13 @@ describe('vim.diagnostic', function()
it('allows filtering by line', function()
eq(
- 1,
+ 2,
exec_lua [[
vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, {
make_error("Error 1", 1, 1, 1, 5),
make_warning("Warning on Server 1", 1, 1, 2, 3),
make_info("Ignored information", 1, 1, 2, 3),
- make_error("Error On Other Line", 2, 1, 1, 5),
+ make_error("Error On Other Line", 3, 1, 3, 5),
})
return #vim.diagnostic.get(diagnostic_bufnr, {lnum = 2})
@@ -1192,13 +1192,16 @@ describe('vim.diagnostic', function()
it('allows filtering by line', function()
eq(
- exec_lua [[return { [vim.diagnostic.severity.ERROR] = 1 }]],
+ exec_lua [[return {
+ [vim.diagnostic.severity.WARN] = 1,
+ [vim.diagnostic.severity.INFO] = 1,
+ }]],
exec_lua [[
vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, {
make_error("Error 1", 1, 1, 1, 5),
make_warning("Warning on Server 1", 1, 1, 2, 3),
make_info("Ignored information", 1, 1, 2, 3),
- make_error("Error On Other Line", 2, 1, 1, 5),
+ make_error("Error On Other Line", 3, 1, 3, 5),
})
return vim.diagnostic.count(diagnostic_bufnr, {lnum = 2})