mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
fix(diagnostic): improve validation for list arguments (#16855)
Function arguments that expect a list should explicitly use tbl_islist rather than just checking for a table. This helps catch some simple errors where a single table item is passed as an argument, which passes validation (since it's a table), but causes other errors later on.
This commit is contained in:
@@ -1119,6 +1119,11 @@ describe('vim.diagnostic', function()
|
||||
end)
|
||||
|
||||
describe('set()', function()
|
||||
it('validates its arguments', function()
|
||||
matches("expected a list of diagnostics",
|
||||
pcall_err(exec_lua, [[vim.diagnostic.set(1, 0, {lnum = 1, col = 2})]]))
|
||||
end)
|
||||
|
||||
it('can perform updates after insert_leave', function()
|
||||
exec_lua [[vim.api.nvim_set_current_buf(diagnostic_bufnr)]]
|
||||
nvim("input", "o")
|
||||
|
||||
Reference in New Issue
Block a user