On VSCode for Windows, how do I set my java home user setting to be the value of an environment variable? - visual-studio-code

With VSCode on Windows 10, how do I set my java home user setting to be the value, JAVA_HOME, that is defined in my environment? I've opened my user settings.json file and added
"java.jdt.ls.java.home": "${env:JAVA_HOME}"
I have confirmed in my command prompt and PowerShell that the environment variable is defined. But when I re-load VSCode, I get this error
What's the correct way to point VSCode to my existing JAVA_HOME env var?

Related

How to get vscode to use `conda activate` instead of `source activate`?

When opening a new terminal in vscode, if I have
"python.terminal.activateEnvironment": true
and I already selected a Python interpreter (see related question here and documentation here), then the terminal opens and automatically activates the environment using
source /path/to/the/environment/bin/activate /path/to/the/environment
I can turn this behavior off by setting python.terminal.activateEnvironment to false.
Of course, I can also manually activate the environment using
conda activate /path/to/the/environment
How to get vscode to use conda activate automatically instead of source activate?
Using source as vscode does sets the activated environment as the "base", e.g. if I do conda env list I will see something like:
conda env list
# conda environments:
#
/path/to/the/actual/base/environment
base * /path/to/the/environment
and this causes some issues. For example, if I try to use mamba which I have in my "true" base environment but not in the other one, it will cause a "No such file or directory" error.

Can't appear environment variables editor when edit Path (System environment variable) on Windows 11

I freshly install C/C++ compiler in my new window 11 laptop using MinGW Installer. and when i try add bin folder path to System environment path variable (System Environment Variable > Path) there i can't see Environment Variables Editor instead I found System Variable Editor but my old windows 10 laptop show Environment Variables Editor.
I can't understand what happened. And I don't know how to edit system environment variables using System Variable Editor.
Windows 10 laptop show Edit Environment Variables:
Windows 11 laptop doesn't show Edit Environment Variables but here show System Variable Editor:
I am the new on this platform so please forgive me if I have made any mistakes.
Thank you.
In fact an environment variable is an entire string. Windows 10 just displays multiple values separated by semicolons in a user friendly way. If you want to add a new value, append the value you want at the end of the entire string, and make sure there is a semicolon between the value and the previous one.

Change terminal used by Code-Runner extension in VS Code to cmd while workspace default integrated terminal is powershell?

Is there a setting in VS Code for the Code Runner extension that lets you run in a shell that's different than the workspace's default shell?
For context, my default integrated terminal is powershell. I have the code-runner.runInTerminal setting set (see, e.g., here), and whenever I run python using the extension, it creates a new "Code" powershell integrated terminal (unless one already exists), activates my selected python environment, and runs the code. However, when it tries to activate the environment, I get this popup:
So, I'd like to change the shell that Code Runner uses to cmd, BUT I want to keep using powershell as my default integrated terminal for the workspace.
Changing my workspace's default shell to cmd isn't an option, and neither is changing to a third shell like WSL. This issue indicates to me that the environment activation isn't getting fixed in powershell anytime soon. For now, I've done what the issue suggests and have just stopped Code Runner from activating a new environment in the terminals it creates (set python.terminal.activateEnvironment to false), but I'm worried now I won't be able to have Code Runner use any other python environments than the default one. What can I do?

How to automatically set environment variable for eclipse terminal view?

I use the terminal view in eclipse:
Every time I start the terminal I run a command to set an environment variable, e.g.
SET HTTPS_PROXY=***.**.***.***:****
I need this as a prerequisite to be able to download some python packages with the python package manager, e.g
pip install mesa
=> Is there a way to automatically run a "startup command" when the Eclipse terminal is opened?
I expected that there would be some Eclipse setting to configure the environment variables for the terminal or to specify some initialization script. However, I could not find such a setting.
I tried to set the proxy settings in eclipse.ini
-Dhttp.proxyHost=***.**.***.***
-Dhttp.proxyPort=****
-Dhttp.nonProxyHosts=localhost|127.0.0.1
However, that does not seem to influence the proxy for the terminal view.
(I actually use a portable version of eclipse with EclipseProtable and in EclipsePortable.ini I am already able to specify some extra paths that will be known when I open a terminal view, e.g.
AdditionalPaths=./App/WinPython/python-3.7.2.amd64;
Also see https://portableapps.com/node/32861 for informatino about EclipsePortable
However, I was not able to set envirionment variables in the ini file EclipsePortable.ini.
)
You can use your system environment variable.
In Windows search the "User Account" parameter.
It must show your current account, search for "Environment variable".
Now you can set all the variables you need and they will be used by default in any terminal in Eclipse (restart Eclipse if it was running).

VSCode isn't changing default settings when reinstalled

I previously configured my VSCode to use Fish as its default shell. After deciding I wanted to change it, I reinstalled VSCode. Even after installing, however, the default settings were not changed. They look like this
// The path of the shell that the terminal uses on Linux.
"terminal.integrated.shell.linux": "/usr/local/bin/fish",
// The path of the shell that the terminal uses on OS X.
"terminal.integrated.shell.osx": "/usr/local/bin/fish"
I've tried overriding these settings in user settings to no avail, the terminal won't launch because I don't have fish installed.