redhat-developer / redhat-developer/vscode-java

Reloading a window apprently clears Java project settings due to different workspace storage chosen

未关闭
#3,671 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
TypeScript
星标
2.3k
派生
546
平均合并
20 小时 1 分钟
30 天内合并 PR
11

描述

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
  1. Open a large Java project on a remote machine with SSH remote development
  2. Configure the Java project, e.g. add some source paths
  3. 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).

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先复现远程 SSH 重新加载流程,并比较重新加载前后扩展的 context.storageUri 与 jdt.ls -data 路径。检查所引用的 VS Code extHostStoragePaths.ts 行为,以及扩展对 jdt.ls 启动的处理。完成的标准是:重新加载后 Java 项目设置仍然可用,而不是被移动到 -1 工作区存储目录。

由索引模型根据 Issue 内容生成。

评估

技术栈
java, typescript, vscode
领域
developer-experience, tooling
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。