redhat-developer / redhat-developer/vscode-java

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

Đang mở
#2,134 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

extension-start
Ngôn ngữ chính
TypeScript
Star
2.3k
Fork
546
Merge trung bình
20 giờ 1 phút
Pull request đã merge (30 ngày)
11

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách kiểm tra các khai báo dependency npm của vscode-java và cách graceful-fs được phân giải, sau đó tái hiện tương tác của Codespaces với extension CodeQL được mô tả trong issue. Xác nhận rằng phiên bản graceful-fs được phân giải lớn hơn 4.2.2 và xác minh rằng việc mở một tệp Java không còn gây ra lỗi workspace của cơ sở dữ liệu CodeQL.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
node.js, typescript
Lĩnh vực
devtools, tooling
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.