You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Auto add brackets to if/else/while/do when format code #2846
@snjeza I just tried and it works in eclipse using clean up👍
Clean up is a great feature, and I think we still have two things to do:
Support using blocks in control statements cleanup in jdt.ls, so that we can fix this issue
Promote the discoverability of the clean up feature in the extension. Currently it's available on save, and not easy to find. Maybe a button in the editor menu and webview based wizard would be great, in this way, the clean up can be done as a single "action"
cc @rgrunber@datho7561 who contributed the clean up feature for further suggestion.
Support using blocks in control statements cleanup in jdt.ls, so that we can fix this issue
Looks like this will require a eclipse.jdt.ui PR to access, since the ICleanUpFix class is in the ui package.
When I talked with Roland, he was interested mainly in migrating the clean ups that don't address formatting. I think his reasoning is that any clean ups that fix formatting should really be a part of the formatter instead.
Promote the discoverability of the clean up feature in the extension. Currently it's available on save, and not easy to find. Maybe a button in the editor menu and webview based wizard would be great, in this way, the clean up can be done as a single "action"
From my understanding, the main benefit of the clean ups is that they are run automatically when you save. If you have to perform additional steps to use them, in my opinion they are no longer clean ups, but instead they are closer to something like quick fixes or source actions. I think it's worth discussing if any of the clean ups that we have should be available through other means, like as source actions or through a command.
@datho7561 I think the clean ups can be a part of the current source actions (like what we see in eclipse), and there is also an existing request for this: #1626.
We can also implement a webview to help users to configure available clean ups (like eclipse ui), showing all available clean ups in jdtls. So that there would be only one extra source action: "Clean Up...", and vscode-java behaves like eclipse in the clean up field (available in both source action and save action)
I'm completely open to migrating the control statement fix, provided there is demand for it. We've migrated plenty of cleanups so it shouldn't be too difficult.
I agree with improving the discoverability. When we did java.cleanup.actionsOnSave, the main priority was to start migrating many of the interesting ones (eg. relating to new Java language features). A context menu item for Cleanup ... under Source Action subgroup should be simple to do without requiring too much code.
Activity
testforstephen commentedon Jan 3, 2023
@CsCherrYY could you provide some advice on this issue?
snjeza commentedon Jan 4, 2023
@CsCherrYY @houtaru @testforstephen We could add the control statements cleanup (Use blocks in if/while/for/do statements).
See
CsCherrYY commentedon Jan 6, 2023
@snjeza I just tried and it works in eclipse using clean up👍
Clean up is a great feature, and I think we still have two things to do:
cc @rgrunber @datho7561 who contributed the clean up feature for further suggestion.
datho7561 commentedon Jan 6, 2023
Looks like this will require a eclipse.jdt.ui PR to access, since the ICleanUpFix class is in the ui package.
When I talked with Roland, he was interested mainly in migrating the clean ups that don't address formatting. I think his reasoning is that any clean ups that fix formatting should really be a part of the formatter instead.
From my understanding, the main benefit of the clean ups is that they are run automatically when you save. If you have to perform additional steps to use them, in my opinion they are no longer clean ups, but instead they are closer to something like quick fixes or source actions. I think it's worth discussing if any of the clean ups that we have should be available through other means, like as source actions or through a command.
CsCherrYY commentedon Mar 13, 2023
@datho7561 I think the clean ups can be a part of the current source actions (like what we see in eclipse), and there is also an existing request for this: #1626.
We can also implement a webview to help users to configure available clean ups (like eclipse ui), showing all available clean ups in jdtls. So that there would be only one extra source action: "Clean Up...", and vscode-java behaves like eclipse in the clean up field (available in both source action and save action)
rgrunber commentedon Mar 13, 2023
I'm completely open to migrating the control statement fix, provided there is demand for it. We've migrated plenty of cleanups so it shouldn't be too difficult.
I agree with improving the discoverability. When we did
java.cleanup.actionsOnSave, the main priority was to start migrating many of the interesting ones (eg. relating to new Java language features). A context menu item forCleanup ...underSource Actionsubgroup should be simple to do without requiring too much code.Lastly, https://github.com/redhat-developer/vscode-java/blob/master/document/_java.learnMoreAboutCleanUps.md was just a workaround for lack of proper UI for it on the vscode-java side. We need a UI that displays an editor showing the before/after state of code that is affected by each cleanup. i think we've discussed this before, and there might be some POC for it ?
blacelle commentedon Apr 6, 2023