redhat-developer / redhat-developer/vscode-java

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

オープン
#4,422 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

enhancement
主要言語
TypeScript
スター
2.3k
フォーク
546
平均マージ
20時間 1分
マージ済み PR(30日)
11

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

実装ファイルやテストは指定されていません。.vscode/settings.json の例をワークスペースレベルのエントリーポイントとして使用し、まず java.jdt.ls.java.homejava.configuration.runtimes の扱いから始めてください。プロジェクトが実行環境名でランタイムを選択でき、各ユーザーがその名前を自分の JDK パスに解決できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java, typescript, vscode
領域
developer-experience
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。