Skip to content

Refactoring (moving/renaming) class files in Java does not adapt file contents #16748

@z0rb

Description

@z0rb

Bug Description:

In most IDEs moving a file or renaming it adapts the contents of that file (e.g. change package in case of move or rename the class in the java file in case the file name has changed). IDEs also adapt any other files that reference that file, class or package.

In Theia this does not happen. If a file is renamed the class in the file needs to be renamed manually. If a file is moved to another package it is necessary to adapt all the references in the project manually, which can be a lot of unnecessary work.

Steps to Reproduce:

  1. Create a Java class in a package and reference it from another file.
  2. A) Move the file to a different package and observe that the project needs to be adapted manually to use the new package and also the package in the file itself needs to be adapted manually.
  3. B) Rename a java class file and observe that the class name needs to be adapted manually in the class file.

I have tested this in vscode and it works as expected. On moving a file, first a dialog pops up to confirm that we really want to move the file. Then a second dialog appears querying if the refactoring should also be done:

Image

After confirming all the packages in the project are adapted to the new path.

I wonder if the dialog not appearing is the actual issue here.

Additional Information

  • Operating System: Debian 13 (GNOME)
  • Theia Version: 1.67.0 (Deb package)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugbugs found in the applicationjavaissues related to the java languagetheia-ideissues related to the Theia IDE

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions