fix(diagnostic): resolve buffer number in get() (#16407)

This commit is contained in:
Gregory Anders
2021-11-22 09:22:08 -07:00
committed by GitHub
parent e02d4732f2
commit fd6df7481a
2 changed files with 13 additions and 0 deletions

View File

@@ -128,6 +128,17 @@ describe('vim.diagnostic', function()
eq('Diagnostic #1', result[1].message)
end)
it('resolves buffer number 0 to the current buffer', function()
eq(2, exec_lua [[
vim.api.nvim_set_current_buf(diagnostic_bufnr)
vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, {
make_error('Diagnostic #1', 1, 1, 1, 1),
make_error('Diagnostic #2', 2, 1, 2, 1),
})
return #vim.diagnostic.get(0)
]])
end)
it('saves and count a single error', function()
eq(1, exec_lua [[
vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, {