Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/gopls: implementations fails on internal/lsp/source #35857

Closed
stamblerre opened this issue Nov 26, 2019 · 3 comments
Closed

x/tools/gopls: implementations fails on internal/lsp/source #35857

stamblerre opened this issue Nov 26, 2019 · 3 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@stamblerre
Copy link
Contributor

Going to the implementation of a function in an interface in internal/lsp/source/view.go always fails.

@gopherbot gopherbot added this to the Unreleased milestone Nov 26, 2019
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Nov 26, 2019
@stamblerre
Copy link
Contributor Author

@ridersofrohan investigated this issue, and it comes down to the different types.Objects having pointers to different types.Packages. This is a result of the way that we type-check dependencies. In this case, what happens is:

  • The request originates in internal/lsp/source/view.go, which is type-checked in source.ParseFull mode (since it is an open file).
  • The implementation is internal/lsp/cache, which depends on internal/lsp/source. This package is also in the workspace, which means that it has also been type-checked in full mode. All packages check their dependencies in exported mode. internal/lsp/source is a dependency of this package, so it has been checked in source.ParseExported mode. As a result we end up in a situation where we are comparing 2 different types.Packages.

I'm not sure what the best approach is here. We could probably check if the identifier's package is a dependency of the package being investigated and switch the package being compared?

@stamblerre stamblerre modified the milestones: Unreleased, gopls v1.0 Dec 4, 2019
@gopherbot
Copy link

Change https://golang.org/cl/209759 mentions this issue: internal/lsp: always ParseFull in-workspace dependencies

@muirdm
Copy link

muirdm commented Dec 6, 2019

This still happens for me sometimes. After restarting gopls find-implementations always works, but then later I come back and find-implementations stops working. I would guess the workspace package list is getting out of sync or breaking in some way, but I haven't tracked it down yet.

@stamblerre stamblerre modified the milestones: gopls/v1.0.0, gopls/v0.4.0 Jul 22, 2020
@golang golang locked and limited conversation to collaborators Jul 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants