redhat-developer / redhat-developer/vscode-java

Opened class files in referenced libraries are not restored on restart

Open
#4,406 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description
When workbench.editor.restoreEditors is enabled, opened project files are restored across VSCode restarts, but this does not work with opened class files from a referenced library.

This is fairly annoying when a project significantly involves some source-unavailable library.

To Reproduce

  1. Ensure workbench.editor.restoreEditors is enabled
  2. Create a Java project (e.g. using Gradle)
  3. Add a JAR dependency
  4. Open a class file from the dependency in the "Java Projects" view
  5. Restart VSCode - The class file editor is not present

Having looked at trace-level logs for both this extension and the VSCode extension host, I do not believe they contain any useful information here (no clear consistent error message that seems related to this, and the class file itself is only mentioned once by this extension in the context of a large list of other classfiles that were not open prior to the restart). This issue has also persisted across multiple extension versions and devices, so I highly doubt it is a environment-related issue.

Expected behavior
The opened classfiles should remain open through restarts when workbench.editor.restoreEditors is enabled.

Environment

  • Operating System: Windows 11
  • JDK version: Oracle Java 24.0.2
  • Visual Studio Code version: 1.117.0
  • Java extension version: 1.54.0

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

Start by reproducing the case with workbench.editor.restoreEditors enabled: create a Gradle Java project, add a JAR dependency, open a class from the Java Projects view, and restart VS Code. Trace the extension and extension-host handling of that editor; done means the opened class file is restored after restart.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, typescript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.