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: add support for more code lenses #36787
Comments
@hyangah suggested that we could use code lenses to offer the user an option to start a local godoc server. |
Another code lens feature VS Code Go provides is 'run test' and 'debug test' code actions. They are currently through a separate |
I'm keen to give the |
That's awesome @martskins - please do send a changelist when you're ready :) I think the show message is fine for now (we do something similar for Ideally, we'd be able to write to the VS Code output channel like the extension does, but LSP doesn't support that yet. Looks like @marwan-at-work, who wrote the |
Running tests is tricker than running In
The problem with the gopls window-output is twofold:
So from VSCode's perspective, using that will actually be a much less friendly user experience than what's currently in place until the proposal Rebecca mentioned is accepted and implemented in clients. I believe it was mentioned to me at some point that you can do custom requests and each client will have to implement that custom request, so that's another route but im not familiar with it :) |
For VS Code, there is also 'debug test' code lens that works closely with the debugger. I expect that will be hard to delegate to |
As a vim user I would say that I would find it useful to be able to run tests delegating it to gopls, even if it doesn't output the failure message. I understand that this is far from ideal though. But being able to at least check that the tests still pass is a pretty decent addition. The idea to use VS Code (or vim, or you name it) itself to run the tests sounds to me as a decent compromise until that proposal is accepted though. |
@martskins in VSCode, we already have this implemented on the plugin-level and it uses output channels appropriately. So it would be a step backwards in terms of user experience in VSCode. Would it be possible for gopls to toggle this on/off so that vim users can turn it on and VSCode users can turn it off? Preferably automagically |
Yeah, the plan is to have this feature be off by default until it reaches parity with VS Code. (See more detail in @findleyr's comment on https://golang.org/cl/231959). |
We have many lenses now. What's left to do? |
I would say that the remaining work is to check which code lenses VS Code supports, so that we can try to reach feature parity. Also, we could add the code lens @hyangah suggested in #36787 (comment). |
vscode-go plans to utilize gopls's codelens by replacing the commands List of codelenses currently offered by vscode-go. (@mcjcloud)
Codelenses with open feature requests
|
Change https://golang.org/cl/245358 mentions this issue: |
The "debug test" and "debug benchmark" code lens will be available with |
This CL adds a "debug test" and "debug benchmark" codelens to the intercepted lenses from gopls. Additionally, a fix is included for finding the function name argument in the arguments that come from gopls. Updates golang/go#36787 Change-Id: I1a109902bbee25ecb9bbf4ae1c8d9af1b6d2fa2f Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/245358 Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Change https://golang.org/cl/246017 mentions this issue: |
This CL adds a code lens to run all benchmarks in a file. Additionally, it updates the test command handler to better support both tests and benchmarks. Updates golang/go#36787 Change-Id: I6e90460f7d97607f96c263be0754537764bd0052 Reviewed-on: https://go-review.googlesource.com/c/tools/+/246017 Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
Can add "which interfaces are implemented" code lens? 0 references | impl Writer
func (devNull) Write(p []byte) (int, error) {
return len(p), nil
} |
I'd love to see a code lense to similar to guru's freevars command. |
rust-analyzer has already a good support on codelens, it'll be good to see it lands in gopls as it's super useful. rust-analyzer codelens references/implementations with codelsn info provided by rust-analyzer (calculated based on cursor position) , I can easily debug rust test item in vim using vimspector and test debug currently it's a pain to debug go in neovim |
We should support the
textDocument/codeLens
request type.The VS Code Go extension has a number of code lenses we could add as a starting point.
See microsoft/vscode-go#3003.
The text was updated successfully, but these errors were encountered: