question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Refactor when moving files

See original GitHub issue

Automatically adjust imports and package declarations when moving a class in the file explorer. (As implemented in eclipse/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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:21
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

11reactions
julianosamcommented, 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.

7reactions
testforstephencommented, Jul 10, 2019

See https://github.com/microsoft/vscode/issues/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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

'refactor' move files in VSCode - es6
If I move a file in the editor, it should find all the import statements and update them to the new location. Is...
Read more >
Move to Folder refactoring | JetBrains Rider Documentation
This refactoring helps you move one or several types or files to another project or folder anywhere in your solution.
Read more >
Refactor when moving files #26314 - microsoft/vscode
So if i move a file from a folder to another, i want it's path reference to be updated automatically in the project....
Read more >
Move type to matching file refactoring - Visual Studio ...
This refactoring applies to: ... What: Lets you move the selected type to a separate file with the same name. When: You have...
Read more >
Working with Refactoring
Renaming / Moving Files · Create RenFile1 and RenFile2 as described in steps 1 to 3 underRenaming a File, above. · Within the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found