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

update class name and references when renaming a Java file #1372

Merged
merged 1 commit into from Apr 8, 2020

Conversation

testforstephen
Copy link
Collaborator

Signed-off-by: Jinbo Wang jinbwan@microsoft.com

it requires eclipse-jdtls/eclipse.jdt.ls#1406

Signed-off-by: Jinbo Wang <jinbwan@microsoft.com>
@testforstephen
Copy link
Collaborator Author

rename

@snjeza snjeza self-requested a review April 7, 2020 21:53
@fbricon fbricon merged commit 9cdbf88 into redhat-developer:master Apr 8, 2020
@fbricon
Copy link
Collaborator

fbricon commented Apr 8, 2020

@testforstephen so while this only works for a simple file rename within the same directory, any chance we can fix #641, i.e. when moving file to a different location?

@testforstephen
Copy link
Collaborator Author

Have a look at the moving case, but there is still some problem needed to fix.

Since the file event api at the client side will listen at file explorer operation and workspace edit, that means the file move event is probably from two sources: drag and drop at file explorer, move a CU through move refactoring. For the second operation, it's unnecessary to re-handle it in file event handler. Currently VS Code didn't provide the event source yet (there is a feature request for it microsoft/vscode#93470), the extension itself has to find a way to figure out whether to handle the event.

In the onDidRenameFiles event, we can do that through comparing the package declaration and file location. But the upstream JDT move refactoring implementation won't work in the didRenameFiles, because it requires the references update calculation to be done before the actual move happens. I'm still trying to modify the jdt code to see whether it can reach what you want.

On the other side, it's hard for the extension to detect the event source in the onWillRenameFiles event. If the vscode feature request is ready, we can handle the move case in the onWillRenameFiles event.

@testforstephen testforstephen deleted the jinbo_rename branch April 9, 2020 01:32
@fbricon fbricon added this to the Mid April 2020 milestone Apr 15, 2020
@fbricon fbricon changed the title update its class name and references after filename renamed update class name and references when renaming a Java file Apr 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants