redhat-developer / redhat-developer/vscode-java

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

Abierto
#4,422 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

enhancement
Lenguaje dominante
TypeScript
Estrellas
2.3k
Forks
546
Merge medio
20 h 1 min
PR fusionados (30 d)
11

Descripción

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.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

No se nombran archivos de implementación ni pruebas. Empieza por el manejo de java.jdt.ls.java.home y java.configuration.runtimes, usando el ejemplo .vscode/settings.json como punto de entrada a nivel del espacio de trabajo. Se considera terminado cuando un proyecto puede seleccionar un runtime por su nombre de entorno de ejecución, mientras cada usuario resuelve ese nombre en su propia ruta de JDK.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
java, typescript, vscode
Área
developer-experience
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Tranquilo
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.