mirror of
https://github.com/neovim/neovim.git
synced 2025-12-10 00:22:41 +00:00
feat(diagnostic): add current_line option for virtual_text handler
This commit is contained in:
committed by
Christian Clason
parent
09f9f0a946
commit
38a52caec0
@@ -2160,6 +2160,25 @@ describe('vim.diagnostic', function()
|
||||
eq(1, #result)
|
||||
eq(' An error there!', result[1][4].virt_text[3][1])
|
||||
end)
|
||||
|
||||
it('can only show virtual_text for the current line', function()
|
||||
local result = exec_lua(function()
|
||||
vim.api.nvim_win_set_cursor(0, { 1, 0 })
|
||||
|
||||
vim.diagnostic.config({ virtual_text = { current_line = true } })
|
||||
|
||||
vim.diagnostic.set(_G.diagnostic_ns, _G.diagnostic_bufnr, {
|
||||
_G.make_error('Error here!', 0, 0, 0, 0, 'foo_server'),
|
||||
_G.make_error('Another error there!', 1, 0, 1, 0, 'foo_server'),
|
||||
})
|
||||
|
||||
local extmarks = _G.get_virt_text_extmarks(_G.diagnostic_ns)
|
||||
return extmarks
|
||||
end)
|
||||
|
||||
eq(1, #result)
|
||||
eq(' Error here!', result[1][4].virt_text[3][1])
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('handlers.virtual_lines', function()
|
||||
|
||||
Reference in New Issue
Block a user