Improve code actions#3322
Conversation
8606a1d to
b5e88fe
Compare
|
@rgrunber @fbricon @mickaelistria @testforstephen @jdneo @robstryker Please see b5e88fe#diff-56e3932686a1ea3ebee6857099f5fe41a37cb3ef5f85ebceac12df645c0b053aR435 |
|
Test this please |
| // Inline Constant (static final field) | ||
| if (RefactoringAvailabilityTesterCore.isInlineConstantAvailable((IField) varBinding.getJavaElement())) { | ||
| InlineConstantRefactoring refactoring = new InlineConstantRefactoring(context.getCompilationUnit(), context.getASTRoot(), context.getSelectionOffset(), context.getSelectionLength()); | ||
| if (refactoring != null && refactoring.checkInitialConditions(new NullProgressMonitor()).isOK() && refactoring.getReferences(new NullProgressMonitor(), new RefactoringStatus()).length > 0) { |
There was a problem hiding this comment.
Nice, so with this, we correctly defer these calculations to resolve right ? I noticed ChangeCorrectionProposalCore.getChange() only gets called from codeAction/resolve. That would definitely improve things both for javac and ecj.
There was a problem hiding this comment.
Nice, so with this, we correctly defer these calculations to resolve right
Do you want me to defer Inline Constant, too?
I should change InlineVariableTest.testInlineLocalVariableWithNoReference -
There was a problem hiding this comment.
I guess the issue is that checkInitialConditions is what determines whether there are any references to inline, but by defering it to codeAction/resolve, you end up showing the dialog in cases where it would have been hidden. It seems like a small price to pay for improving performance though, and it's not horribly wrong.
There was a problem hiding this comment.
I guess the issue is that checkInitialConditions is what determines whether there are any references to inline,
Right.
but by defering it to codeAction/resolve, you end up showing the dialog in cases where it would have been hidden. It seems like a small price to pay for improving performance though, and it's not horribly wrong.
We can solve it in a separate issue. The dialog requires a client update.
|
@rgrunber @mickaelistria @fbricon @datho7561 You may want to take a look at 5f8662f#diff-270b2ca4a5a67f649246cad6e57d708531a75d91fdadb33c7186f0b02369745eR340 |
rgrunber
left a comment
There was a problem hiding this comment.
Looks pretty good overall. Just need to review that "change signature part".
You have to use redhat-developer/vscode-java#3845 or try https://github.com/snjeza/vscode-test/raw/refs/heads/master/java-1.38.3.vsix |
|
Test this please. |
rgrunber
left a comment
There was a problem hiding this comment.
Overall, looks pretty good. Just one issue I found with the "Introduce Parameter" seeming to permit things that it later denies.
Signed-off-by: Snjezana Peco <snjezana.peco@redhat.com>
|
test this please |
|
Just from testing on lemminx with triggering code actions on Before (javac) After (javac) 🧑💻 ⬅️ 🕶️ |
rgrunber
left a comment
There was a problem hiding this comment.
Overall, I think this is ready to be merged. It will definitely improve the code action performance, and given that it gets triggered per cursor re-location, it should free up the worker threads for other computations.
@snjeza , what's the situtation with the unit.reconcile(..) issue ? Is there anything to do there at a later time ?
We can't do anything. |
There were changes to no longer provide the `signature` within the code-action command arguments but instead require an additional request from the client. See: - eclipse-jdtls/eclipse.jdt.ls#3322 - redhat-developer/vscode-java#3845 Closes: #743
There were changes to no longer provide the `signature` within the code-action command arguments but instead require an additional request from the client. See: - eclipse-jdtls/eclipse.jdt.ls#3322 - redhat-developer/vscode-java#3845 Closes: #743

Fixes #3321
Requires redhat-developer/vscode-java#3845
I have configured code actions in a similar way Eclipse does it.
Test vsix: https://github.com/snjeza/vscode-test/raw/refs/heads/master/java-1.38.5.vsix