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

Refactor when moving files #641

Closed
fwcd opened this issue Sep 14, 2018 · 9 comments · Fixed by #1815
Closed

Refactor when moving files #641

fwcd opened this issue Sep 14, 2018 · 9 comments · Fixed by #1815

Comments

@fwcd
Copy link
Contributor

fwcd commented Sep 14, 2018

Automatically adjust imports and package declarations when moving a class in the file explorer. (As implemented in eclipse-jdtls/eclipse.jdt.ls#683 ?)

Environment

  • Operating System: Windows 10
  • JDK version: 1.8.0_144
  • Visual Studio Code version: 1.27.2
  • Java extension version: 0.30.0

Steps To Reproduce

  1. Move a Java source file to another folder in the explorer

Current Result

  1. The imports in other source files are not updated

Expected Result

  1. The imports should be updated accordingly
@akaroml
Copy link
Contributor

akaroml commented Oct 9, 2018

The original change was made for Eclipse Che. @yaohaizh can we also enable this feature at vscode side?

@julianosam
Copy link

julianosam commented Oct 22, 2018

That's literally the one thing that's stopping this (amazing) tool to become the # 1 choice for Java development. I am the only developer in a project of near 100 Java developers who is using VSCode for Java. People are very impressed when I show my Java code in VSCode and also skeptical. So they ask "can it do this?" or "I bet if you try this it won't let you...". And refactoring is a key point. I confess I've been relying on Eclipse to do more complex code refactoring... It'd be great to have this fetaure incorporated in the tool.

@yaohaizh yaohaizh self-assigned this Oct 23, 2018
@SpenceUK
Copy link

Automatically fixing imports across the project and package declarations would be a killer feature for Java in vscode.

@testforstephen
Copy link
Collaborator

testforstephen commented Jul 10, 2019

See microsoft/vscode#43768, vscode will fire an FileWillRenameEvent when the user is renaming or moving (drag and drop) files in file explorer. By listening at this event, the language server is able to update package declaration and references.

Currently the change is proposed at vscode insider. When it's officially ready, it will unblock us on the refactoring features such as move/rename file/rename package name.

@nistvan86
Copy link

What is the current status on this? There's some work merged here microsoft/vscode#85830
but I see an open ticket for a language server protocol extension microsoft/language-server-protocol#873

@liudonghua123
Copy link

I also like this feature

@noel-yap
Copy link

Is there a way I can get notification for when this fix is released?

@fwcd
Copy link
Contributor Author

fwcd commented Jul 16, 2020

@noel-yap You can subscribe to this issue and choose to only get notified once it closes.

@Sayyiditow
Copy link

Hi any update on this?

@testforstephen testforstephen linked a pull request Nov 24, 2020 that will close this issue
@testforstephen testforstephen linked a pull request Feb 24, 2021 that will close this issue
@testforstephen testforstephen added this to the End March 2021 milestone Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants