redhat-developer / redhat-developer/vscode-java

Installing this extension in codespaces monkey patches fs which can break other extensions.

未关闭
#2,134 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

extension-start
主要语言
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
  1. Install both extensions
  2. Open the codeql pane (load codeql extension)
  3. Wait for codeql to startup (can take some time due to needing to download codeql itself).
  4. In codeql extension choose download a database from lgtm; Pick g/apache/maven, then java.
  5. Open the codeql pane (load codeql extension again)
  6. Open a java file (load java extension)
  7. In the workspace root look in the newly added top level root starting apache_maven_...
  8. An error about accessing pipes on undefined happens.
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 (using graceful-fs) so that some values become computed properties.
  • vscode-codeql "subclasses" classes in fs due to (using graceful-fs) internally.
  • The broken version of graceful-fs in vscode-java is loaded and accidentally mutates fs (due to the use of computed properties in the patched version of fs).
  • The "classes" in vscode-codeql don't have the new prototype in the chain so the new constructors from the broken version of fs create new objects rather than modifying this.

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.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 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

把新 issue 发到你的邮箱

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