mirror of
https://github.com/neovim/neovim.git
synced 2025-12-11 09:02:40 +00:00
Merge pull request #14184 from tjdevries/tjdevries/nit_diagnostics
lsp: some small diagnostic fixes
This commit is contained in:
@@ -293,6 +293,19 @@ local function text_document_did_open_handler(bufnr, client)
|
|||||||
}
|
}
|
||||||
client.notify('textDocument/didOpen', params)
|
client.notify('textDocument/didOpen', params)
|
||||||
util.buf_versions[bufnr] = params.textDocument.version
|
util.buf_versions[bufnr] = params.textDocument.version
|
||||||
|
|
||||||
|
-- Next chance we get, we should re-do the diagnostics
|
||||||
|
vim.schedule(function()
|
||||||
|
vim.lsp.handlers["textDocument/publishDiagnostics"](
|
||||||
|
nil,
|
||||||
|
"textDocument/publishDiagnostics",
|
||||||
|
{
|
||||||
|
diagnostics = vim.lsp.diagnostic.get(bufnr, client.id),
|
||||||
|
uri = vim.uri_from_bufnr(bufnr),
|
||||||
|
},
|
||||||
|
client.id
|
||||||
|
)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- FIXME: DOC: Shouldn't need to use a dummy function
|
-- FIXME: DOC: Shouldn't need to use a dummy function
|
||||||
|
|||||||
@@ -270,8 +270,10 @@ local function set_diagnostic_cache(diagnostics, bufnr, client_id)
|
|||||||
diagnostic.severity = DiagnosticSeverity.Error
|
diagnostic.severity = DiagnosticSeverity.Error
|
||||||
end
|
end
|
||||||
-- Account for servers that place diagnostics on terminating newline
|
-- Account for servers that place diagnostics on terminating newline
|
||||||
local start = diagnostic.range.start
|
if buf_line_count > 0 then
|
||||||
start.line = math.min(start.line, buf_line_count - 1)
|
local start = diagnostic.range.start
|
||||||
|
start.line = math.min(start.line, buf_line_count - 1)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
diagnostic_cache[bufnr][client_id] = diagnostics
|
diagnostic_cache[bufnr][client_id] = diagnostics
|
||||||
|
|||||||
Reference in New Issue
Block a user