-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: revisit the set of 'quickfix' refactorings #71038
Comments
CC @adonovan The option is still there. However, it has moved to the 'Refactor' menu. |
I'll note that this is an unclear decision. We used to serve all refactoring in the 'quick fix' menu, but some people noted that having lightbulbs for each cursor position was distracting. Other editors make refactoring quick fixes more prominent than VS Code. |
@h9jiang is there a better way for us to surface these refactorings? |
To provide some context, the lightbulb I believe is code actions response returned from gopls when you move the cursor. The lightbulb only shows up if the response is not empty. (meaning gopls think there is a code action available for place your cursor is selecting) From the code perspective, the current behavior is intended. @adonovan recently changed the behavior of automatic code action response. (There are two kind, the first one is automatic where the vscode trigger code action automatically when you move the cursor. The second one is where the user trigger the code action manually by Previously, both return the full list of code actions including Re: findleyr@, I'm not sure if there is a better way of surfacing these code actions else where. I will keep reading. However, I did notice a different behavior for TypeScript LSP. Manual Code Action for async function Automatic Code Action for async function Maybe the more important code action is surfaced as lightbulb (automatic) and everything is surfaced as code action (manual). I will keep researching. |
can I set the fillStruct to the automatic code action? Because it is indeed very useful. Now I have to downgrade the gopls version. thx. |
@alanlwb we will revisit this for v0.18.0, which is actually scheduled quite soon (end of Jan / early Feb). Unfortunately, for now if you need these to be available with the lightbulb, you must downgrade. Promoting this to a gopls issue to make a decision about the behavior. |
Thanks @h9jiang for the analysis. Sounds like we need to revisit the set of refactorings available in the quickfix menu, or consider changes to the VS Code extension to make refactorings more readily available. |
Filling the structure as a quick fix was very convenient, especially when using a mouse. I did it all the time. |
@igor-spirin-indriver yes, we'll fix this for gopsl@v0.18.0 (which is actually quite soon as we want to release this before Go 1.24). We think we interpreted 'quick fix' too literally, only returning fixes for diagnostics.
@adonovan @h9jiang what do you think? If we agree, we can document these heuristics and fix our dispatch. |
Why can gopls@v0.16.2 do fill struct code action and gopls@v0.17.1 doesn't
feature or bug ?
gopls@v0.16.2gopls@v0.17.1
The text was updated successfully, but these errors were encountered: