redhat-developer / redhat-developer/vscode-java

`java.jdt.ls.java.home` should use the Java execution environment name

Đang mở
#4,422 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.

enhancement
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ả

Description

I've been trying to configure several Java projects in Visual Studio Code and have noticed that the java.jdt.ls.java.home setting, among others, is always required.

This setting belongs in the project's workspace (unless you work in one project, or have a perfectly aligned setup), but it cannot be set as such because for a multi-user project, each one will definitely have a different path for the JDK.

I think it would be great if this setting could take the (reference) value of one the existing Java execution environments instead, and tries to read the path of the corresponding JDK. This way, the configuration is fixed, set at the project level, and only needs to change if the project upgrades to a newer JDK.

For instance:

// Global User Settings
{
  ...
  "java.configuration.runtimes": [
    {
      "javadoc": "https://docs.oracle.com/en/java/javase/17/docs/api/index.html",
      "name": "JavaSE-17",
      "path": "/home/x80486/.local/share/mise/installs/java/temurin-17",
      "sources": "/home/x80486/.local/share/mise/installs/java/temurin-17/lib/src.zip"
    },
    {
      "default": true,
      "javadoc": "https://docs.oracle.com/en/java/javase/21/docs/api/index.html",
      "name": "JavaSE-21",
      "path": "/home/x80486/.local/share/mise/installs/java/temurin-21",
      "sources": "/home/x80486/.local/share/mise/installs/java/temurin-21/lib/src.zip"
    }
  ],
  ...
}

Then for each project I work on, I could just set in .vscode/settings.json:

{
  "java.jdt.ls.java.home": "JavaSE-21"
}

Additional Context

This is just an idea with the existing settings. It may be even more appropriate to define something new that could unify all the settings that request the location of the JDK, but it should always refer in one way or another to the java.configuration.runtimes (preferably by name), otherwise it's impossible to set this correctly —in a way that works for everyone regardless of the architecture and location/installation of the Java SDK—, at the project level.

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

Không có tệp triển khai hoặc bài kiểm thử nào được nêu tên. Hãy bắt đầu với việc xử lý java.jdt.ls.java.homejava.configuration.runtimes, sử dụng ví dụ .vscode/settings.json làm điểm bắt đầu ở cấp workspace. Hoàn thành nghĩa là một dự án có thể chọn một runtime theo tên môi trường thực thi, trong khi mỗi người dùng ánh xạ tên đó tới đường dẫn JDK của riêng mình.

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

Đánh giá

Công nghệ
java, typescript, vscode
Lĩnh vực
developer-experience
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Ít trao đổi
Độ 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.