redhat-developer / redhat-developer/vscode-java

[Feature Request] Execute git mv when class is moved via refactor

Open
#2,848 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

code action enhancement
Dominant language
TypeScript
Stars
2.3k
Forks
546
Avg merge
20h 1m
Merged PRs (30d)
11

Description

Currently when refactoring a class in a git repo, the refactoring action provided by the Java language server simply creates a new class file and deletes the old one. The git mv command requires the file being moved to exist not only in the change history, but also within the repo itself. This means that if one would like to execute git mv to preserve the commit history of the file, they must initiate the refactor, manually move the file back to its original location, prompt the language server to skip refactoring for this second move, and finally execute git mv to have change history be preserved.

Environment
  • Operating System: Windows 11
  • JDK version: 17
  • Visual Studio Code version: 1.74.2
  • Java extension version: 1.13.0
Steps To Reproduce
  1. Initiate refactoring of a Java class
  2. Observe the class is moved, but the git history is not preserved
Current Result

Git history is not preserved

Expected Result

Git history is preserved

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files, tests, or entry points are named in the issue. Begin at the Java refactoring action and its VS Code extension integration, then trace how class moves are performed. Done means a class move preserves Git history on the stated Windows setup while retaining the existing refactoring behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, java, typescript, vscode
Domain
developer-experience, devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.