diff options
author | Michael Lingelbach <m.j.lbach@gmail.com> | 2021-03-05 07:27:50 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-05 07:27:50 -0800 |
commit | 3fbff98cfd48941ceac086543dd7d6bcdbfb18ab (patch) | |
tree | 191431d808b6f0d8e494a0d6e67ffe3a888f16e6 /runtime/lua/vim/lsp/diagnostic.lua | |
parent | 8f4b9b8b7de3a24279fad914e9d7ad5ac1213034 (diff) | |
parent | db96edb58d2a490b245c7a9f57e12b632fed290f (diff) | |
download | rneovim-3fbff98cfd48941ceac086543dd7d6bcdbfb18ab.tar.gz rneovim-3fbff98cfd48941ceac086543dd7d6bcdbfb18ab.tar.bz2 rneovim-3fbff98cfd48941ceac086543dd7d6bcdbfb18ab.zip |
Merge pull request #13793 from mjlbach/fix_terminating_eol_diagnostic
[RDY] lsp: fix diagnostic reported on terminating EOL character
Diffstat (limited to 'runtime/lua/vim/lsp/diagnostic.lua')
-rw-r--r-- | runtime/lua/vim/lsp/diagnostic.lua | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua index df25943ecd..a1f24706c0 100644 --- a/runtime/lua/vim/lsp/diagnostic.lua +++ b/runtime/lua/vim/lsp/diagnostic.lua @@ -264,10 +264,14 @@ local function set_diagnostic_cache(diagnostics, bufnr, client_id) -- The diagnostic's severity. Can be omitted. If omitted it is up to the -- client to interpret diagnostics as error, warning, info or hint. -- TODO: Replace this with server-specific heuristics to infer severity. + local buf_line_count = vim.api.nvim_buf_line_count(bufnr) for _, diagnostic in ipairs(diagnostics) do if diagnostic.severity == nil then diagnostic.severity = DiagnosticSeverity.Error end + -- Account for servers that place diagnostics on terminating newline + local start = diagnostic.range.start + start.line = math.min(start.line, buf_line_count - 1) end diagnostic_cache[bufnr][client_id] = diagnostics |