commit efa6d91132c71d6efca1b813b0129b1085389a48
parent f6ca9262b89c945883ae9bcf46035bfa1ea51bde
Author: Robert Muir <rmuir@apache.org>
Date: Sun, 4 Jan 2026 18:07:00 -0500
fix(diagnostic): display 1-based related information line/col numbers (#37093)
Problem
LSP Related Information line and column numbers are 0-based. Displaying
them this way can confuse the user, since vim line/col numbers are
typically displayed 1-based.
Solution
Display the line and column numbers as 1-based.
Diffstat:
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua
@@ -2571,8 +2571,8 @@ function M.open_float(opts, ...)
'%s%s:%s:%s%s',
default_pre,
file_name,
- location.range.start.line,
- location.range.start.character,
+ location.range.start.line + 1,
+ location.range.start.character + 1,
info_suffix
)
highlights[#highlights + 1] = {
diff --git a/test/functional/lua/diagnostic_spec.lua b/test/functional/lua/diagnostic_spec.lua
@@ -3559,8 +3559,8 @@ describe('vim.diagnostic', function()
eq(
{
'1. Some warning',
- ' uri:1:0: Some extra info',
- ' uri:2:3: Some more extra info',
+ ' uri:2:1: Some extra info',
+ ' uri:3:4: Some more extra info',
},
exec_lua(function()
---@type vim.Diagnostic