feat(diagnostic): revert default behaviour of goto_next/prev()

Follow-up to #28490

Problem:

The new behaviour of goto_next/prev() of navigating to the next highest
severity doesn't work well when diagnostic providers have different
interpretations of severities. E.g. the user may be blocked from
navigating to a useful LSP warning, due to some linter error.

Solution:

The behaviour of next highest severity is now a hidden option
`_highest = true`. We can revisit how to integrate this behaviour
during the 0.11 cycle.
This commit is contained in:
Lewis Russell
2024-04-30 09:57:31 +01:00
committed by Lewis Russell
parent 0330dd9e69
commit ee41153a94
4 changed files with 45 additions and 40 deletions

View File

@@ -962,7 +962,7 @@ describe('vim.diagnostic', function()
eq(
{ 3, 0 },
exec_lua([[
vim.diagnostic.goto_next()
vim.diagnostic.goto_next({_highest = true})
return vim.api.nvim_win_get_cursor(0)
]])
)
@@ -970,7 +970,7 @@ describe('vim.diagnostic', function()
eq(
{ 5, 0 },
exec_lua([[
vim.diagnostic.goto_next()
vim.diagnostic.goto_next({_highest = true})
return vim.api.nvim_win_get_cursor(0)
]])
)
@@ -991,7 +991,7 @@ describe('vim.diagnostic', function()
eq(
{ 4, 0 },
exec_lua([[
vim.diagnostic.goto_next()
vim.diagnostic.goto_next({_highest = true})
return vim.api.nvim_win_get_cursor(0)
]])
)
@@ -999,7 +999,7 @@ describe('vim.diagnostic', function()
eq(
{ 6, 0 },
exec_lua([[
vim.diagnostic.goto_next()
vim.diagnostic.goto_next({_highest = true})
return vim.api.nvim_win_get_cursor(0)
]])
)
@@ -1021,7 +1021,7 @@ describe('vim.diagnostic', function()
eq(
{ 2, 0 },
exec_lua([[
vim.diagnostic.goto_next({ severity = { min = vim.diagnostic.severity.HINT } })
vim.diagnostic.goto_next()
return vim.api.nvim_win_get_cursor(0)
]])
)
@@ -1029,7 +1029,7 @@ describe('vim.diagnostic', function()
eq(
{ 3, 0 },
exec_lua([[
vim.diagnostic.goto_next({ severity = { min = vim.diagnostic.severity.HINT } })
vim.diagnostic.goto_next()
return vim.api.nvim_win_get_cursor(0)
]])
)
@@ -1037,7 +1037,7 @@ describe('vim.diagnostic', function()
eq(
{ 4, 0 },
exec_lua([[
vim.diagnostic.goto_next({ severity = { min = vim.diagnostic.severity.HINT } })
vim.diagnostic.goto_next()
return vim.api.nvim_win_get_cursor(0)
]])
)