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: go to the definition of the only non-test interface implementation #40584

Open
ainar-g opened this issue Aug 5, 2020 · 1 comment
Labels

Comments

@ainar-g
Copy link
Contributor

@ainar-g ainar-g commented Aug 5, 2020

(Currently using v0.4.4 with Go 1.14.6.)

When exploring new codebases I often go to the definition of a method just to find out that the method is actually a part of an interface. I then use the “find implementations” action to find the implementation. Often there is only one non-test implementation.

So, I would like to request a new action which would act like the current one, but go to the definition of the only non-test interface implementation if there is only one, or to the definition of the interface if there are several.

@gopherbot gopherbot added this to the Unreleased milestone Aug 5, 2020
@ainar-g ainar-g changed the title x/tools/gopls: go to the definitioin of the only non-test interface implementation x/tools/gopls: go to the definition of the only non-test interface implementation Aug 5, 2020
@muirdm
Copy link

@muirdm muirdm commented Aug 5, 2020

I've been wanting this myself for find-implementations and find-references as well. In particular, I want a way to only return non-test results for find-implementations and find-references.

By default it should work the way it does now since that is most correct and what people expect. That means we need an option to control gopls behavior. There is precedent for options in find-references with the "includeDeclaration", but there is no option for excluding tests.

I think in the short term this functionality would need to be implemented in the LSP client (i.e. the editor). For the long term we can open an LSP feature request to add a "excludeTests" option to find-implementations and find-references and see what they think. I looked briefly but didn't see any existing issues.

@stamblerre stamblerre removed this from the Unreleased milestone Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.