aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/functional/plugin/lsp/diagnostic_spec.lua28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/functional/plugin/lsp/diagnostic_spec.lua b/test/functional/plugin/lsp/diagnostic_spec.lua
index 779c4641b9..76b1808883 100644
--- a/test/functional/plugin/lsp/diagnostic_spec.lua
+++ b/test/functional/plugin/lsp/diagnostic_spec.lua
@@ -317,6 +317,34 @@ describe('vim.lsp.diagnostic', function()
eq('Pull Diagnostic', diags[1].message)
end)
+ it('severity defaults to error if missing', function()
+ ---@type vim.Diagnostic[]
+ local diagnostics = exec_lua([[
+ vim.lsp.diagnostic.on_diagnostic(nil,
+ {
+ kind = 'full',
+ items = {
+ {
+ range = make_range(4, 4, 4, 4),
+ message = "bad!",
+ }
+ }
+ },
+ {
+ params = {
+ textDocument = { uri = fake_uri },
+ },
+ uri = fake_uri,
+ client_id = client_id,
+ },
+ {}
+ )
+ return vim.diagnostic.get(diagnostic_bufnr)
+ ]])
+ eq(1, #diagnostics)
+ eq(1, diagnostics[1].severity)
+ end)
+
it('allows configuring the virtual text via vim.lsp.with', function()
local expected_spacing = 10
local extmarks = exec_lua(