redhat-developer / vscode-java

Java Language Support for Visual Studio Code
Eclipse Public License 2.0
2.05k stars 420 forks source link

JDK config in both windows and linux #3660

Open petercao opened 1 month ago

petercao commented 1 month ago

I need to work both in windows and linux(such as archlinux), So when I switch from windows to linux, I need to reconfig JDK path in settings.json config file, but when I reswitch to windows, I need to change JDK config path to windows format again, So do we have some kind of argument that both can config for linux and windows, such as:

/// JDK config for windows "java.jdt.ls.androidSupport.enabled": "on", "java.jdt.ls.java.home.windows": "D:\Program Files\Java\jdk-17", "java.configuration.runtimes": [ { "name": "JavaSE-17", "path": "D:\Program Files\Java\jdk-17", "default": true } ], /// JDK config for linux "java.jdt.ls.java.home.linux": "/jdk-17", "java.configuration.runtimes": [ { "name": "JavaSE-17", "path": "/jdk-17", "default": true } ],

and it will read current system os info and auto switch to corresponding configurations? Can we?

zippozeng commented 1 month ago

I also need this feature and I agree with your suggestion

fbricon commented 1 month ago

Why don't you configure your user settings on your windows and on your linux machines with the proper paths?

petercao commented 1 month ago

As I say, you need to reconfigure jdk path for vscode both in windows and linux, because it can't auto fix the system, and the old local jdk config will be overlay by the synced new config

fbricon commented 1 month ago

So the problem is caused by synch'ing the same user config on multiple OS. Do other extensions work around that VS Code synch limitation? Honestly the simplest solution is to disable synch'ing

fbricon commented 1 month ago

Have you tried https://github.com/microsoft/vscode/issues/5595#issuecomment-1864078397 ? Seems like the best workaround currently

zippozeng commented 1 month ago

Have you tried microsoft/vscode#5595 (comment) ? Seems like the best workaround currently

vscode does not support this configuration, this is what the user came up with

petercao commented 1 month ago

So the problem is caused by synch'ing the same user config on multiple OS. Do other extensions work around that VS Code synch limitation? Honestly the simplest solution is to disable synch'ing

yeah, it's about the syncing, but you know I will install some plugins or change some config some time, so I need to sync them in different os(linux/windows), some of the config is not platform related, but others like jdk is just platform related. So this is the question.

iwangbowen commented 1 week ago

Yes, we need this feature