Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Go specific contextual menu #275

Closed
mattetti opened this issue Apr 1, 2016 · 5 comments
Closed

Go specific contextual menu #275

mattetti opened this issue Apr 1, 2016 · 5 comments

Comments

@mattetti
Copy link
Contributor

mattetti commented Apr 1, 2016

Does VSC extension API support customization of the contextual menu. There are a few things I'd love ot see for instance:

  • right click on a function/method call that isn't implemented and generate a snippet named after the selected symbol.
  • right click on a go file and choose create a test file which would generate a new test file named after the selected file.
  • extract/refactor feature - select a chunk of code, right click > extract as function, pick a name, the selected code is now used as the body of a new function which is called from the location where the code used to be.

Is that kind of stuff doable, part of the scope and something you're interested in seeing, or is that something that should live as its own extension?

@lukehoban
Copy link
Contributor

Not currently - but see microsoft/vscode#4762.

As for the Go features mentioned here - all make sense to me. All of these could probably be added as commands that can be invoked through the command palette already - and then added into a context menu in the future if/when that extension point is opened up.

Happy to accept PRs for features like these.

@vastbinderj
Copy link

vastbinderj commented May 13, 2016

My only comment on testing, is that in my experience it is better to have tests in a separate package from the package being tested. In this manner you are testing the package in the same way it will be used.

I really like the other suggestions and in addition would like go build, go run and go test shortcuts which I did create after fashion by wading thru other issues in this repo.

@mattetti
Copy link
Contributor Author

@lukehoban is that feature now in vscode? It would be really great if we could add a context menu to show interfaces a value/type is implementing. That can be done using guru implements query (we already use guru): https://docs.google.com/document/d/1SLk36YRjjMgKqe490mSRzOPYEDe0Y_WQNRv-EiFYUyw/view#heading=h.15us5y9rxrbh

@egamma
Copy link
Member

egamma commented Jul 11, 2016

@mattetti VS Code now supports that an extension can contribute to the menus. Please see https://code.visualstudio.com/Updates#_extension-authoring.

@ramya-rao-a
Copy link
Contributor

@mattetti Closing the loop on this. As you know contextual menu is now possible in VS Code.

right click on a function/method call that isn't implemented and generate a snippet named after the selected symbol.

#277 is tracking this request

right click on a go file and choose create a test file which would generate a new test file named after the selected file.

We now have commands to generate unit tests

image

extract/refactor feature - select a chunk of code, right click > extract as function, pick a name, the selected code is now used as the body of a new function which is called from the location where the code used to be.

#588 will track this request

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants