Skip to content
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

Support change signature refactoring #2497

Merged
merged 5 commits into from Mar 17, 2023

Conversation

CsCherrYY
Copy link
Contributor

@CsCherrYY CsCherrYY commented Feb 27, 2023

related to redhat-developer/vscode-java#2967, more details and demo videos can be found in that PR.

This PR includes several added files which can be excluded after eclipse-jdt/eclipse.jdt.ui#428 got merged. To be specific, the classes in org.eclipse.jdt.internal package.

test cases can be found in ChangeSignatureHandlerTest

@CsCherrYY
Copy link
Contributor Author

test this please

@jdneo
Copy link
Contributor

jdneo commented Mar 15, 2023

test this please

newExceptionInfos.add(ExceptionInfo.createInfoForAddedException(type));
}
} else {
IType type = cu.getJavaProject().findType(exception.type);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do some context-aware search first here? For example:

  1. Check if the exception type appears in the import declarations.
  2. If it's Exception, just simply treat it as java.lang.Exception

Copy link
Contributor Author

@CsCherrYY CsCherrYY Mar 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eda6e38 dffe5f4 introduces several handlings for this.

Signed-off-by: Shi Chen <chenshi@microsoft.com>
Signed-off-by: Shi Chen <chenshi@microsoft.com>
Signed-off-by: Shi Chen <chenshi@microsoft.com>
Signed-off-by: Shi Chen <chenshi@microsoft.com>
2. find possible match types in existing import declarations
3. filter non-public types for Exception

Signed-off-by: Shi Chen <chenshi@microsoft.com>
Copy link
Contributor

@jdneo jdneo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good to me. We can address the issue separately. If more users are asking for it.

@jdneo jdneo merged commit 9c97b34 into eclipse-jdtls:master Mar 17, 2023
@testforstephen testforstephen added this to the Early April 2023 milestone Mar 17, 2023
@mfussenegger
Copy link
Contributor

Would it make sense to add this behind a new extended client capability? In clients other than vscode this now shows a Change signature for XY refactor option which doesn't do anything if selected.

@jdneo
Copy link
Contributor

jdneo commented Mar 17, 2023

@mfussenegger Yes it makes sense. Would you like to raise a PR for that?

mfussenegger added a commit to mfussenegger/nvim-jdtls that referenced this pull request Mar 17, 2023
mfussenegger added a commit to mfussenegger/nvim-jdtls that referenced this pull request Mar 17, 2023
mfussenegger added a commit to mfussenegger/nvim-jdtls that referenced this pull request Mar 17, 2023
@CsCherrYY CsCherrYY deleted the cs-changeSignature branch March 20, 2023 02:32
@rgrunber
Copy link
Contributor

rgrunber commented Apr 3, 2023

eclipse-jdt/eclipse.jdt.ui#428 was merged, so feel free to create a PR with TP update, and with some reference changes we can claw back ~6500 (I think) of copied code 🚀

@Eskibear
Copy link
Contributor

Eskibear commented Apr 4, 2023

kudos!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants