redhat-developer / redhat-developer/vscode-java
Reloading a window apprently clears Java project settings due to different workspace storage chosen
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 546
- Avg merge
- 20h 1m
- Merged PRs (30d)
- 11
Description
Environment
- Operating System: macOS (local host) + Linux (SSH remote host)
- JDK version: 17.0.9
- Visual Studio Code version: 1.89.1
- Java extension version: 1.31.0
Steps To Reproduce
- Open a large Java project on a remote machine with SSH remote development
- Configure the Java project, e.g. add some source paths
- Reload the window
Current Result
Configuration added in the step 2 is apparently lost.
Expected Result
Configuration added in the step 2 is kept.
Additional Informations
I found that the -data directory passed to jdt.ls differs before/after the reload.
- Before:
-data /usr/local/google/home/nya/.vscode-server/data/User/workspaceStorage/4f53a3d603ab9ba87f981c0821b0dc62/redhat.java/jdt_ws - After:
-data /usr/local/google/home/nya/.vscode-server/data/User/workspaceStorage/4f53a3d603ab9ba87f981c0821b0dc62-1/redhat.java/jdt_ws
Notice the -1 suffix added to the workspace storage directory.
In fact, a VSCode extension may receive different context.storageUri for the identical workspace when multiple instances of VSCode opens the workspace concurrently (c.f. https://github.com/microsoft/vscode/issues/128234). This can happen even on a window reload because a storage directory lock is released only on the VSCode process exit (https://github.com/microsoft/vscode/blob/5f646b8e67a869ef33061085ffe0e377d5ba040c/src/vs/workbench/api/node/extHostStoragePaths.ts#L52).
I guess this problem happens only in remote development because VSCode skips obtaining locks for local extension hosts (https://github.com/microsoft/vscode/issues/128528).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the remote SSH reload flow and compare the extension's context.storageUri with the jdt.ls -data path before and after reload. Review the referenced VS Code extHostStoragePaths.ts behavior and the extension's jdt.ls launch handling. Done means Java project settings remain available after reload instead of moving to a -1 workspace storage directory.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, typescript, vscode
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100