redhat-developer / redhat-developer/vscode-java
Installing this extension in codespaces monkey patches fs which can break other extensions.
还没有人认领这个 Issue。
- 主要语言
- TypeScript
- 星标
- 2.3k
- 派生
- 546
- 平均合并
- 20 小时 1 分钟
- 30 天内合并 PR
- 11
描述
Installing both this vscode-java in a codespace breaks the codeql extension.
Environment
- Operating System: codespaces
- JDK version:
- Visual Studio Code version:
- Java extension version:
Steps To Reproduce
- Install both extensions
- Open the codeql pane (load codeql extension)
- Wait for codeql to startup (can take some time due to needing to download
codeqlitself). - In codeql extension choose download a database from lgtm; Pick
g/apache/maven, thenjava. - Open the codeql pane (load codeql extension again)
- Open a java file (load java extension)
- In the workspace root look in the newly added top level root starting
apache_maven_... - An error about accessing
pipesonundefinedhappens.
Additional Informations
This is a very complex 3 way interaction between the 2 extensions and codespaces. The underlying bug is https://github.com/isaacs/node-graceful-fs/issues/170 which is fixed with newer versions of graceful-fs. This is still used by vscode-java so things break I can't quite work out how an old version ends up in vscode-java as the only runtime dependency is optional but specifying --no-optional doesn't fix it (I am not a js/npm expert).
The full issue happens due to the following steps:
- Basically codespaces patches
fs(usinggraceful-fs) so that some values become computed properties. vscode-codeql"subclasses" classes infsdue to (usinggraceful-fs) internally.- The broken version of graceful-fs in
vscode-javais loaded and accidentally mutatesfs(due to the use of computed properties in the patched version offs). - The "classes" in
vscode-codeqldon't have the new prototype in the chain so the new constructors from the broken version offscreate new objects rather than modifyingthis.
Note that the issues with fs having properties is also the case with node 15+ but vscode is on 14 so this will break in future whenever vscode updates nodejs that far.
To fix it you need to ensure the version of graceful-fs is greater than 4.2.2 where the bug is fixed.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先检查 vscode-java 的 npm 依赖声明以及 graceful-fs 的解析方式,然后重现 issue 中描述的 Codespaces 与 CodeQL 扩展的交互。确认解析出的 graceful-fs 版本大于 4.2.2,并验证打开 Java 文件不再导致 CodeQL 数据库工作区错误。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- node.js, typescript
- 领域
- devtools, tooling
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100