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/cmd/guru: no way to find functions which are assignable to (match the signature of) a function type #25165
Comments
This would be a nice feature and could probably become part of the existing "implements" query. If you'd like to contribute the code you wrote, feel free to send out a review. Otherwise, I'd be happy to look into adding this. |
Does anyone have any interest in reviewing this on Gerrit? https://go-review.googlesource.com/c/tools/+/114800 |
This has been superseded by gopls, just cleaning up! |
Hi @a-h, would you be so kind as to point me somewhere I can find how to use this in |
Oh, I mean that Language Servers like From a quick glance, it looks like the spec does support the request to go to an implementation via https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_implementation So the code relating to the implementation would be here. https://cs.opensource.google/go/x/tools/+/refs/tags/v0.1.9:internal/lsp/cmd/implementation.go I expect it would be possible to use the code I wrote as a basis for an LSP implementation. I would still like the feature, but not enough to revisit this change and make it happen. Maybe if I had a nice long holiday... |
Just to be clear, I'm not sure if |
I see what you mean, thank you for clarifying and pointing to the related resources. |
If I define a function type:
And a function which accepts a
Printer
:I'd like to be able to use
guru
to find methods which satisfy thePrinter
type's signature. I'd also be able to find any matching functions for an anonymous function signature too (e.g.var x func(s string)
).guru
is often used to provide text editor features. Having the ability to discover implementations would allow being able to place a caret onp Printer
, selectFind implementations
from the text editor options, then view a list of possible implementations to use.I've put together an example of how this might work at https://gist.github.com/a-h/dd48a97aba7c07f988aac8e529dadf6d
(See Stackoverflow question at https://stackoverflow.com/questions/50059956/how-do-i-find-implementations-of-a-function-type/50086309#50086309)
The text was updated successfully, but these errors were encountered: