redhat-developer / redhat-developer/vscode-java
Installing this extension in codespaces monkey patches fs which can break other extensions.
まだ誰も着手していません。
- 主要言語
- TypeScript
- スター
- 2.3k
- フォーク
- 546
- 平均マージ
- 20時間 1分
- マージ済み PR(30日)
- 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 にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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