[tools] gopls/internal/mcp: report one-based reference line numbers

0 views
Skip to first unread message

Madeline Kalil (Gerrit)

unread,
Aug 10, 2026, 5:08:13 PM (13 hours ago) Aug 10
to shuang cui, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Dmitri Shuralyov, Dmitri Shuralyov, Hongxiang Jiang, Alan Donovan, golang...@luci-project-accounts.iam.gserviceaccount.com, golang-co...@googlegroups.com

Madeline Kalil submitted the change

Change information

Commit message:
gopls/internal/mcp: report one-based reference line numbers

formatReferences currently embeds zero-based LSP line numbers in its
human-readable output. This causes, for example, a declaration on the
third source line to be reported as being on line 2.

Convert reference line numbers to one-based values for display while
retaining zero-based indexing when reading the corresponding source
line.

Update the MCP marker tests accordingly.
Change-Id: I9b7675756e8b828ac7f00fbe371d7e908cfe426c
Reviewed-by: Madeline Kalil <mka...@google.com>
Reviewed-by: Dmitri Shuralyov <dmit...@google.com>
Files:
  • M gopls/internal/mcp/references.go
  • M gopls/internal/test/marker/testdata/mcptools/references.txt
  • M gopls/internal/test/marker/testdata/mcptools/symbol_references.txt
Change size: S
Delta: 3 files changed, 8 insertions(+), 8 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: I9b7675756e8b828ac7f00fbe371d7e908cfe426c
Gerrit-Change-Number: 805820
Gerrit-PatchSet: 2
Gerrit-Owner: shuang cui <imc...@gmail.com>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Dmitri Shuralyov <dmit...@google.com>
Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Reviewer: Madeline Kalil <mka...@google.com>
Gerrit-Reviewer: shuang cui <imc...@gmail.com>
Gerrit-CC: Dmitri Shuralyov <dmit...@golang.org>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages