Closed katsusan closed 2 years ago
Thank you for the repro.
I believe this is the same as #46158, but I am investigating.
Duplicate of #46158
Hi @findleyr, thank you for the fix, it seems there is still an edge case not covered.
Another reproduce:
version:
D:\Projects\leetcode>gopls version
golang.org/x/tools/gopls v0.7.2
golang.org/x/tools/gopls@v0.7.2 h1:kRKKdvA8GOzra8rhSFDClOR7hV/x8v0J0Vm4C/gWq8s=
D:\Projects\leetcode>go version
go version go1.17 windows/amd64
steps:
$GOROOT/src/runtime/proc.go
.debug
in following code.
https://github.com/golang/go/blob/6097ebe627b7bc58d63d6765abc005f548b9644c/src/runtime/proc.go#L199-L202hover result:
Thanks very much for the repro.
Just looked into this. The debug struct is a real edge case: it is a var with a large struct literal type. For vars we use types.ObjectString
to format their signature, which usually looks reasonable but in this case produces a very large type expression. It's hard to imagine doing something else: if we naively used the declaration syntax we'd have to handle all sorts of edge cases, like x := 2 // no type
or x := []byte{/* lots of data */}
, etc.
So I think the original issue is fixed, and we are unlikely to spend engineering time addressing this particular edge case. Closing so that this issue doesn't stagnate.
Thank you Robert for the investigation, the edge case doesn't miss type information and gopls needs improvement in other more important aspects, so it doesn't deserve if needs too much time.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Version of gopls:
Editor: VSCode Reproducing steps:
/usr/local/go/src/runtime/panic.go
in VSCode._panic
in following code. https://github.com/golang/go/blob/7677616a263e8ded606cc8297cb67ddc667a876e/src/runtime/panic.go#L871_panic
in another line. https://github.com/golang/go/blob/7677616a263e8ded606cc8297cb67ddc667a876e/src/runtime/panic.go#L916What did you expect to see?
step 3 give the same output as step 2.
What did you see instead?
step 2 gives:
step 3 gives:
Appendix
// step 2
// step 3
HoverIdentifier
returned differentHoverInformation
. But the source hasn't been changed for a long time. Is it feature or I need some extra options for gopls?https://github.com/golang/tools/blob/55cd4804dfa0984a27cd61589b7f56f937e05545/internal/lsp/source/hover.go#L66-L71
// step 2
// step3