[tools] gopls/internal/server: support type def with selected range

0 views
Skip to first unread message

Hongxiang Jiang (Gerrit)

unread,
Dec 16, 2025, 2:18:37 PM (14 hours ago) Dec 16
to goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Madeline Kalil, Go LUCI, Alan Donovan, golang-co...@googlegroups.com

Hongxiang Jiang submitted the change

Change information

Commit message:
gopls/internal/server: support type def with selected range

The logical validation for textDocumentPositionParam is moved
to protocol level ensures the validation will be done for all
LSP method param who extends textDocumentPositionParam.

gopls type def will be able to interpret the selected range
from the lsp client. If the selected range evaludate to an
expression, gopls will return the type of the expression.

gopls will return multiple locations for types.Signature or
Tuple without any special filering for type error.

vscode-go CL 727560

For golang/go#76723
Change-Id: I63e241da7b87d31f94e41db7d252e8230789579c
Reviewed-by: Madeline Kalil <mka...@google.com>
Files:
  • M gopls/internal/golang/hover.go
  • M gopls/internal/golang/identifier.go
  • M gopls/internal/golang/type_definition.go
  • M gopls/internal/protocol/generate/output.go
  • M gopls/internal/protocol/tsserver.go
  • M gopls/internal/server/definition.go
  • M gopls/internal/server/hover.go
  • M gopls/internal/test/integration/fake/editor.go
  • M gopls/internal/test/integration/misc/definition_test.go
  • A gopls/internal/test/marker/testdata/typedef/expression.txt
  • M gopls/internal/test/marker/testdata/typedef/typedef.txt
Change size: L
Delta: 11 files changed, 198 insertions(+), 133 deletions(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +2 by Madeline Kalil
  • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
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: I63e241da7b87d31f94e41db7d252e8230789579c
Gerrit-Change-Number: 728600
Gerrit-PatchSet: 8
Gerrit-Owner: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Reviewer: Madeline Kalil <mka...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages