mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
lsp: Unopened buffers return 0 for line count, which leads to broken positions
This commit is contained in:
parent
880fb0d146
commit
875979ec3f
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user