vscode-java icon indicating copy to clipboard operation
vscode-java copied to clipboard

Avoid need of restart of Visual Studio Code when updating java.home

Open apupier opened this issue 4 years ago • 5 comments

It would be nice to not have to restart Visual Studio Code when changing Java Home

Environment
  • Operating System:
  • JDK version:
  • Visual Studio Code version:
  • Java extension version:
Steps To Reproduce
  1. File -> Preferences -> Settings -> Java -> Home -> Edit in settings.json 2.provide a different value to java.home
  2. save
Current Result

a notification is provided asking to restart

Screenshot from 2021-03-26 11-58-41

Expected Result

new java home is used without restart of Visual Studio code

Additional Informations

cc @orpiske

apupier avatar Mar 26 '21 11:03 apupier

I can't remember which one does it, but some extension does restart its language server after changing some config. So it's doable. Need to evaluate the impacts on other extensions depending on vscode-java

fbricon avatar Mar 26 '21 11:03 fbricon

See related https://github.com/microsoft/vscode/issues/76405

fbricon avatar Mar 26 '21 11:03 fbricon

We certainly do this with crashes of the language server so it makes sense.

Is the the java.home only being modified to change the project JDK ? There is a better way to do this. If compatible JDKs are defined in the settings, then it should be possible to just update the project's build configuration and switch without ever restarting.

rgrunber avatar Mar 26 '21 15:03 rgrunber

changes in the runtimes configuration don't require a reload and are updated on-the-fly on impacted projects.

The issue is java.home used to launch jdt.ls

fbricon avatar Mar 26 '21 15:03 fbricon

This has come up again as a request so perhaps we should prioritize it in the future. Not only for the Java home location, but even for things like the vmargs settings (eg. lombok configuration).

Note that with the embedded JRE, java.home is deprecated and the new property is java.jdt.ls.java.home.

rgrunber avatar Jun 15 '22 16:06 rgrunber