-
Notifications
You must be signed in to change notification settings - Fork 798
Use gopls rather than godoctor for extract refactorings #518
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
Comments
@sorenh thanks! Yes, that's the directory we are heading. I was told both extract function and extract variable features are available since gopls v0.4.4. Some prerequisite decision making necessary before transitioning to gopls
I am leaning towards dropping the commands and waiting for the LSP improvement. /cc @joshbaum @stamblerre |
If I invoke the "Source Action" command, I'm told "No source actions available". What am I doing wrong? "gopls version" tells me I'm running version 0.4.4. |
@sorenh: If you highlight a range of text, you should see a lightbulb appear with a suggestion to "Extract to function". Does that work? |
@stamblerre Nope. It does for e.g. Typescript (check with the vscode source). |
@stamblerre Er... Now it does. I have absolutely no clue what I changed. I opened the "Typescript" output as well as the "gopls" and "gopls (server)" outputs to see if that might give me some clues. When I looked at my own source code, the light bulb was there. |
@stamblerre I just tried with code-insiders. Didn't do anything at all and now it works. I'm so confused. |
Hm..not sure what was going on there, but glad it works now! |
I will close this bug now and track the command migration separately. |
Is your feature request related to a problem? Please describe.
If a project uses go.mod mode, the extract refactorings don't work as it depends on godoctor which does not yet support modules.
Describe the solution you'd like
gopls now supports these extract refactorings. The vscode plugin should use that instead of godoctor.
Describe alternatives you've considered
There's work in progress to make godoctor support modules, but a) it has stalled and b) since gopls provides the functionality it makes sense to use that instead.
Additional context
The most recent releases(s?) of gopls has this functionality, so we should be able to safely rely on it.
The text was updated successfully, but these errors were encountered: