Laragon terminal in VSCode with Laragon PATH environment variable - visual-studio-code

How to use the Laragon terminal in VSCode with Laragon PATH environment variable (on Windows)?
I want to use the Laragon terminal in Visual Studio Code.
I want to use the local Laragon PHP, Composer, MySQL, Node.js, etc. in the terminal.

Open Laragon, right click > Tools > Path > Manage Path.
Copy everything between the --- Laragon --- and the next section (probably --- User ---).
I also put the three lines starting with C:\\Users\\[YOUR_USERNAME]\\AppData\\ at the start, so the Laragon composer and npm are used instead of the global ones.
Put all the paths on one line (they should be separated by a semicolon), and double all the backslashes.
Open your project settings.json, and add these values:
"terminal.integrated.shell.windows": "C:\\[PATH_TO_LARAGON]\\Laragon\\bin\\git\\bin\\bash.exe",
"terminal.integrated.env.windows": {
"PATH": "[PASTE_THE_PATHS_HERE];${env:PATH}"
}
The first line makes the Laragon terminal default.
The second one makes the terminal use the Laragon paths/binaries.
6. You can also add the Laragon php path as the language validation executable:
"php.validate.executablePath": "C:\\[PATH_TO_LARAGON]\\Laragon\\bin\\php\\php-8.0.3-Win32-vs16-x64\\php.exe"
On my computer settings.json looks like this:
{
"terminal.integrated.shell.windows": "C:\\[PATH_TO_LARAGON]\\Laragon\\bin\\git\\bin\\bash.exe",
"terminal.integrated.env.windows": {
"PATH": "C:\\Users\\[YOUR_USERNAME]\\AppData\\Local\\Yarn\\config\\global\\node_modules\\.bin;C:\\Users\\[YOUR_USERNAME]\\AppData\\Roaming\\Composer\\vendor\\bin;C:\\Users\\[YOUR_USERNAME]\\AppData\\Roaming\\npm;C:\\[PATH_TO_LARAGON]\\Laragon\\bin;C:\\[PATH_TO_LARAGON]\\Laragon\\bin\\apache\\httpd-2.4.35-win64-VC15\\bin;C:\\[PATH_TO_LARAGON]\\Laragon\\bin\\composer;C:\\[PATH_TO_LARAGON]\\Laragon\\bin\\git\\bin;C:\\[PATH_TO_LARAGON]\\Laragon\\bin\\git\\cmd;C:\\[PATH_TO_LARAGON]\\Laragon\\bin\\git\\mingw64\\bin;C:\\[PATH_TO_LARAGON]\\Laragon\\bin\\git\\usr\\bin;C:\\[PATH_TO_LARAGON]\\Laragon\\bin\\laragon\\utils;C:\\[PATH_TO_LARAGON]\\Laragon\\bin\\mysql\\mysql-5.7.24-winx64\\bin;C:\\[PATH_TO_LARAGON]\\Laragon\\bin\\nginx\\nginx-1.16.0;C:\\[PATH_TO_LARAGON]\\Laragon\\bin\\ngrok;C:\\[PATH_TO_LARAGON]\\Laragon\\bin\\nodejs\\node-v12;C:\\[PATH_TO_LARAGON]\\Laragon\\bin\\notepad++;C:\\[PATH_TO_LARAGON]\\Laragon\\bin\\php\\php-8.0.3-Win32-vs16-x64;C:\\[PATH_TO_LARAGON]\\Laragon\\bin\\putty;C:\\[PATH_TO_LARAGON]\\Laragon\\bin\\redis\\redis-x64-3.2.100;C:\\[PATH_TO_LARAGON]\\Laragon\\bin\\telnet;C:\\[PATH_TO_LARAGON]\\Laragon\\usr\\bin;${env:PATH}"
},
"php.validate.executablePath": "C:\\[PATH_TO_LARAGON]\\Laragon\\bin\\php\\php-8.0.3-Win32-vs16-x64\\php.exe"
}
You can check what's in the PATH environment variable by opening the terminal and typing env.
To check which path to binary is used for php, composer, etc., type which php, which composer, etc.
Of course, [YOUR_USERNAME] should be your username, and [PATH_TO_LARAGON] should be the path to the folder containing Laragon.
Don't forget to change the paths if you start using another versphp ion (of php, apache, ...).
On other operating systems, the solution should be similar, but this answer is for Windows.

Related

Can't run `terminal.integrated.env` command in integrated terminal: "command not found"

Following this manual page:
https://code.visualstudio.com/docs/python/environments
I would have to set PYTHONPATH "through the terminal settings":
The PYTHONPATH environment variable specifies additional locations
where the Python interpreter should look for modules. In VS Code,
PYTHONPATH can be set through the terminal settings
(terminal.integrated.env.*) and/or within an .env file.
How do I do that? If I write (I ssh to a Linux server):
terminal.integrated.env.linux
I get "command not found".
It seems you tried to enter this
terminal.integrated.env.linux
into the terminal prompt itself, which treated it as a literal command.
What that guide on PYTHONPATH meant when it said "through the terminal settings" was Visual Studio Code's Integrated Terminal settings: https://code.visualstudio.com/docs/getstarted/settings. Specifically the settings under Terminal (filtered on terminal.integrated.env):
Depending on your OS/platform, you put a terminal.integrated.env.<os> block in your VS Code's settings.json file to specify the environment variables to inject when using VS Code's integrated terminal:
From https://code.visualstudio.com/docs/getstarted/settings#_default-settings:
// Object with environment variables that will be added to the
// VS Code process to be used by the terminal on Linux. Set to
// `null` to delete the environment variable.
"terminal.integrated.env.linux": {},
So if you are on Linux:
"terminal.integrated.env.linux": {
"PYTHONPATH": "<absolute path>"
},
Note: see the Python docs on PYTHONPATH on what exactly needs to be specified here.
Or, as the guide says, you can also specify a .env file.

Set the path in portable vscode installation powershell terminal

I have multiple versions of vscode installed on my system with portable mode. I start each of them via a desktop shortcut. Since they are in portable mode, their installation directories are not in the default PATH variable.
When I make a new powershell terminal window, the portable vscode directory is not on the path. I need the command "code" in the terminal window to run the same vscode version that the terminal shell is running in. In other words, if I am running a portable vscode, and I open a powershell terminal and type the command "code", I want it to run the code.exe file that is the same as the vscode I am running it in, and not a different one, and not get the "object not found" message. For various reasons I do not want to have to type the full path.
So, in essence, I want to add a directory to the path variable when vscode starts up, with that directory being the base directory of the vscode itself.
You need to set this in: File/Preferences/Settings then select Workspace, there go to: Terminal/Integrated:Cmd and there specify An explicit start path where the terminal will be launched.

How to correctly set PYTHONPATH for Visual Studio Code

How do I correctly set up the $PYTHONPATH variable for my workspace in VisualStudio Code?
Background Information
I have installed two versions of GNURadio:
GNURadio version 3.7.11 installed by the Linux Mint package manager in /usr/lib/python2.7/dist-packages/gnuradio
GNURadio version 3.7.13.4 installed by PyBOMBS in /home/tejul/Documents/gr13/default/lib/python2.7/dist-packages/gnuradio (my prefix directory is ~/Documents/gr13/default)
I can use the newer version of GNURadio version only after I run the setup_env.sh script (which -- among other things -- adds /home/tejul/Documents/gr13/default/lib/python2.7/dist-packages to $PYTHONPATH) and then start python in the terminal
tejul#Wacom:~/Documents/gr13/default$ ls
bin etc include lib libexec setup_env.sh share src
tejul#Wacom:~/Documents/gr13/default$ source ./setup_env.sh
tejul#Wacom:~/Documents/gr13/default$ python
Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from gnuradio import gr
>>> gr.version()
'3.7.13.4'
>>>
Without modifying the $PYTHONPATH python -- naturally -- imports the older version of GNURadio.
I want to write, run, and debug python scripts for the new version of GNURadio in the VisualStudio Code. I've been trying to understand the selection of python interpreters, workspaces, and environments for VSCode.
As far as I understand it, the VSCode workspace setting python.pythonPath is not to be confused with the environment variable $PYTHONPATH. python.pythonPath is the path to the python interpreter used for debugging or running the code, while $PYTHONPATH is the environment variable which python uses to search for modules.
It looks like PyBOMBS did not install its own python interpreter into my prefix directory. So I need to use VSCode with my normal python interpreter located in /usr/bin/python2.7. So redefining VSCode's python.pythonPath or selecting another python interpreter would not help me.
I need to let VSCode use my own version of the environment variable $PYTHONPATH which would tell my regular python interpreter to import modules preferably from /home/tejul/Documents/gr13/default/lib/python2.7/dist-packages.
Problem
Following the documentation, I have created my own .env file in the workspace directory which sets the order of preference for locations from which python should import the modules. Alas, it has no effect on the python interpreter.
Can you see anything that I am doing wrong here? I have also tried:
Setting the PYTHONPATH to one folder level higher, i.e. /home/tejul/Documents/gr13/default/lib/python2.7, this did not help
Calling the variable $PYTHONPATH instead of PYTHONPATH, this did not help
Restarting VSCode after each change of the .env file, this did not help
Using double quotes around the path string, e.g. PYTHONPATH="/home/tejul/Documents/gr13/default/lib/python2.7:/usr/lib/python2.7", this did not help
I have a situation that I believe is relatively common. I want a script to import a module from another directory. My python project is laid out as follows:
~/project/
|
|---modules/
|
|---mod.py
|---scripts/
|---script.py
in script.py, I have from modules import mod. So my PYTHONPATH needs to be set to ~/project/ (something that PyCharm does automatically).
VSCode is a great editor, but everywhere else, it falls short, in my opinion. This is a perfect example of that.
I create a default launch.json file to "run the current file". A "cwd": "${fileDirname}" line has to be added to make things work like they do in PyCharm (FYI, a list of the built-in variables can be found here).
Debugging
For debugging (the "play" button on the sidebar, or the F5 key), the PYTHONPATH set in launch.json or your .env file takes effect. Note that in the .env file, you cannot use variables such as ${workspaceRoot}, but you can easily append or insert to the path by using the proper separator for your platform (; for Windows and : for everyone else).
Because I want to take advantage of that variable, I put this in my launch.json:
"env": {"PYTHONPATH": "${workspaceFolder}${pathSeparator}${env:PYTHONPATH}"}
(Thanks to #someonr for the suggestion to use ${pathSeparator}.)
It appears that you can prepend/append to whatever is inherited from the environment (this is not true for settings.json; see below).
This will also work for the hotkey Ctrl+F5 (run without debugging).
For reference, here's the full file, which replicates what PyCharm does automatically:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"cwd": "${fileDirname}",
"env": {"PYTHONPATH": "${workspaceFolder}${pathSeparator}${env:PYTHONPATH}"}
}
]
}
Run in terminal
If I hit the "play" button that appears on the top right of the editor window (when a python file is the active tab), it will not work. This runs the current file in a terminal, which doesn't pay attention to launch.json at all. To make that work, you have to define PYTHONPATH in a settings.json file, by adding this:
"terminal.integrated.env.osx": {"PYTHONPATH": "${workspaceFolder}"}
(Note there are different values for each platform.) If you've selected a python interpreter (e.g. from a virtual environment), you will already have a settings.json file in the .vscode directory. Mine looks like this:
{
"python.pythonPath": "/Users/me/project/venv/bin/python3",
"terminal.integrated.env.osx": {"PYTHONPATH": "${workspaceFolder}"}
}
You can't append or insert values into the inherited PYTHONPATH via the settings.json file. It will only take one string, and it will not parse separators. So even though you could get the value using ${env:PYTHONPATH}, you won't be able to do anything with it.
Moreover, you can't set the current working directory. Even though it would seem you could set it with "terminal.integrated.cwd": "${workspaceFolder}", it doesn't work. So if any of your scripts do anything with paths relative to their location in the tree, they won't work. The working directory will be your project root.
Note that any changes to the settings.json file will require that you exit the integrated terminal and restart it.
Linting
Nothing I do to launch.json regarding PYTHONPATH makes any difference to pylint, which will red-underline from modules import mod, despite the fact I can put the cursor on mod, hit F12, and the file opens. Snooping around linting settings, the defaults for mypy include --ignore-missing-imports. To replicate this behavior with pylint, add this to your settings.json:
"python.linting.pylintArgs": [
"--disable=F0401"
]
Shame that we just have to work around this, but the autocomplete helps a lot when writing the import statements to begin with.
Conclusion
There are many layers to VSCode and it's hard to get things to work together. It seems multiple environments are floating around. In the end:
I cannot "run in terminal" because I can't set the current working directory to be the path containing the current file.
I cannot set PYTHONPATH for pylint as that runs in some environment different than the integrated terminal and whatever is controlled by launch.json, so I can only tell pylint to ignore import errors.
Running with F5 works if you set PYTHONPATH either via an .env file or in launch.json
This question deserves an upvote because the documentation is missing some important details.
Example
Suppose your project layout is like this
myproject/
.vscode/
settings.json
.env
src/
a_module.py
tests/
test_a.py
Open the settings.json fie and insert these lines
"terminal.integrated.env.windows": {
"PYTHONPATH": "${workspaceFolder}/src;${workspaceFolder}/tests"
},
"python.envFile": "${workspaceFolder}/.env",
Note that ${workspaceFolder} evaluates to myproject, it is not to the .vscode folder.
In the .env file enter this
WORKSPACE_FOLDER=C:/full/path/to/myproject
PYTHONPATH=${WORKSPACE_FOLDER}/src;${WORKSPACE_FOLDER}/tests
Note that on Windows the slashes in the path lean forward, like so /. Different paths are separated with a ; (on other platforms with a :).
This blog was helpful.
OP seemed to have asked about path syntax for the .env file and the vscode set up so that it finds and reads some custom module files. My problem was similar in that I wanted code to find my custom modules for import in a script. I did not want to put my custom modules in a folder inside my python environment. I also wanted to avoid setting one or more paths as PYTHONPATH for the User Variables in the Windows Environment Variables - but this will work if you want to do it.
I am working in vscode in Windows 10.
1) SYNTAX:
a) I found that the following path syntax works in the env file:
PYTHONPATH = C:/0APPS/PYTHON/_MODULES
My .py module files are in this folder.
b) # works for comments in the .env file.
2) VSCODE SET-UP: I found that the following works:
a) Like sunew said at #2 My setup: Use the Explorer in vscode to open at your selected project workspace folder. For me that is Q:\420 PYTHON
b) Give the env file a name, like vscode.env file and place it in that folder at the top level of the workspace.
c) Open vscode settings and search .env where under the Extensions > Python you will find "Python: env file". Edit the box to add your env file name just before .env.
e.g. ${workspaceFolder}/vscode.env
d) import custom_modulename now work for me - in the python interactive window and in a script.
Setting PYTHONPATH in .env works for me.
Note that the effect just is for vscode and the tools it runs, such as pylint.
My situation:
I have a project that is not a pip installable package, but simply a source folder. (For historical reasons...)
myproject/src
The project has dependencies defined in a pip requires file.
My setup:
I create a virtualenv, and install the packages from the requires file.
I open vscode in the folder myproject - so this becomes the root of the vscode "project".
I point vscode to use the virtualenv as the python interpreter. This will make imports of dependencies installed with pip work. (For linters, intellisense, etc)
To also make imports from my project source work for the linters (pylint especially) in vscode, I add a .env with this content, adding my project source folder to the PYTHONPATH:
PYTHONPATH=./src:${PYTHONPATH}
For tools like Pyright you can edit python.analysis.extraPaths in the workspace settings.json.
Example:
{
...
"python.analysis.extraPaths": [
"src/apps",
"src/override_apps"
],
...
// next lines can be different
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.mypyEnabled": false,
"python.pythonPath": "environment/bin/python",
...
}
Linux user here. I had trouble getting it to work and there is a lot of interaction with other vscode Python extension settings, but the following worked for me:
Close all workspaces.
Add a single folder that you wish to be the root folder of your new workspace.
Put your .env file there containing PYTHONPATH=/path/to/a:/path/to/b on a single line by itself. Do not use double quotes around the value.
Restart vscode
Create a test.py script that imports a package or module within your folder
vscode should allow your import statement, and should autocomplete to code within your folder.
Edit settings.json in your vs code workspace folder
{
"python.pythonPath": "*python package path*",
"terminal.integrated.env.windows": {
"PYTHONPATH": "${workspaceFolder}/*sub folder*;*python package path*"
},
"python.defaultInterpreterPath": "*path to python exe*",
"python.analysis.extraPaths": [
"*python package path*",
"*python package path*"
],
"python.autoComplete.extraPaths": [
"*python package path*",
"*python package path*"
]}
Works good!
I also had a similar issue where I was using the vs-code on a remote server over ssh, the server had multiple user-accounts so the typical ubuntu python path did not work for me.
The easiest way, I have found for doing debugging was to first find out my own python install location using "which python". The output would be something like "/home/user_name/anaconda3/bin/python".
Then in vs-code, I manually set the python interpreter location to be the above location. I did this by clicking on the python tab on the bottom of vs code. like the Python 3.8.5 64-bit in this picture.
This will open the command pallete asking for the location of python interpreter, as shown in this image. manually put the location of python install here.
After doing all these steps, my python debugging is working smoothly.
Running VSCode 1.6.2, with Python extension v2021.10.1365161279 on Windows 10.
Debugging works based on the env file, I used the default file .env:
PYTHONPATH=<full_path_to_the_workspace_folder>
Running works based on the .vscode/settings.json file with such a setting
"terminal.integrated.env.windows": {"PYTHONPATH": "<full_path_to_the_workspace_folder>"}
just that I found I needed to disable+reload+enable the extension if I changed the path.
Two other issues that I spent a long time figuring out (despite the great answers above) which may help others:
Make sure that you have configured VS Code to allow terminal
configurations to amend your shell settings (via Manage Workspace
Shell Permissions (see
https://code.visualstudio.com/docs/editor/integrated-terminal#_configuration). Otherwise VS Code silently ignores your
terminal.integrated.env.{platform} settings.
Pylint will only search for other modules in the worspace directory if the module from which it is launched is in a folder which is a package (ie has _init_.py file) (See https://docs.pylint.org/en/1.6.0/run.html) meaning that pylint will continue to highlight import errors despite the code running properly due to the VS Code launch.json configured as above.
These are 3 different ways to solve the issue :
1/ Editing PYTHONPATH :
export PYTHONPATH=/Users/.../Projects/MyNewProject/src
python3 myfile.py to run the file
2/ Editing VSCode settings :
add "terminal.integrated.env.osx": {"PYTHONPATH": "${workspaceFolder}/src"} to settings.json in VScode
3/ Adding a setup.py file to your src/ directory.
create the file src/setup.py
from setuptools import find_packages, setup
setup(
name="sample",
description="Sample Python Project",
packages=find_packages(),
)
run python -m pip install -e ./src/ to install all modules in src/ as packages
After for reasons unknown my .venv/Lib/site-packages/.pth solution failed, as well as my subsequent .vscode\settings.json one, and an .env didn't work on my Windows 10*, I settled for the environment-independent way to import ./src/lib.py in ./test/test_lib.py:
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../src'))
from lib import foo
That also works in non-IDE terminals, and VS Code's pycodestyle still complains when I forget an extra newline between functions.
*: VS Code 1.70.0 release note:
Loading environment variables from .env files
A number of fixes have been made to loading environment variables from
.env files, including detecting changes to the .env files. Python
kernels will now load environment variables from the file defined in
the setting python.envFile.
Using VS Code, a pip virtual env, you can put at the end of the .venv/bin/activate file:
export PYTHONPATH="${PYTHONPATH}:/path/to/your/package"
package -> module1 -> abc.py and you can use: import module.abc etc.

Set global $PATH environment variable in VS Code

I'm defining a custom $PATH environment variable in my ~/.bash_profile (on a Mac), like so:
PATH="$HOME/.cargo/bin:$PATH:$HOME/bin"
However, VS Code of course does not run my .bash_profile, so it does not have my custom paths. In fact, if I Toggle Developer Tools and check process.env.PATH, it doesn't even seem to have /usr/local/bin.
How do I globally set the $PATH environment variable in VS Code?
(I want to set it globally, not per project or per task, since I'm maintaining a lot of small packages.)
If you only need the $PATH to be set in the integrated terminal, you can use VS Code's terminal.integrated.env.<platform> variable (added in version 1.15). Press Cmd+Shift+P (or Ctrl+Shift+P) and search for "Preferences: Open Settings (JSON)". Then add the following entry to the settings file:
"terminal.integrated.env.osx": {
"PATH": "...:/usr/bin:/bin:..."
}
(Replace .osx with .linux or .windows as needed.)
To see your system's $PATH, type echo "$PATH" in Terminal.app, and copy and paste it into the settings snippet above.
As for having the $PATH available everwhere in VS Code, so that it will
be used by extensions that call binaries, the only workaround I've found so far is this:
Configure your shell (bash by default) to have the $PATH you want. For example, my ~/.bash_profile has the following line:
PATH="$PATH:$HOME/bin"
In VS Code, press ⇧⌘P and type install 'code' command if you haven't done so before.
Quit VS Code.
Launch VS Code not by clicking the icon in the dock or in Launchpad, but by opening Terminal.app and typing code. Your newly set path will be active in VS Code until you quit it.
If VS Code restarts, for example due to an upgrade, the $PATH will reset to the system default. In that case, quit VS Code and re-launch it by typing code.
Update: VS Code on Mac and Linux now apparently tries to automatically resolve the shell environment when it is started by clicking the icon (rather than via code). It does this by temporarily starting a shell and reading the environment variables. I haven't tested this though.
In:
> Preferences: Open Settings (JSON)
add to the JSON file:
"terminal.integrated.env.windows": {
"PATH": "${env:PATH}"
},
-> terminal.integrated.env should end with .osx, .linux or .windows depending on your OS.
In order to check if it works execute in your VS Code Terminal:
# For PowerShell
echo $env:PATH
# For bash
echo "$PATH"
I am using vscode on macos for C/C++ development in conjunction with CMake.
The vscode extension CMake Tools allows to manipulate environment variables via the configuration properties cmake.configureEnvironment, cmake.buildEnvironment and cmake.environment (acting respectively on the CMake configuration phase, the build phase and both - see docs).
Then you can extend your system PATH with custom paths by adding the following snippet to your user or project settings.json:
"cmake.environment": {
"PATH": "~/.myTool/bin:${env:PATH}"
},
Visual Studio Code is the problem.
No matter how you set your PATH variable in the shell, there are cases where Visual Studio Code will not inherit your PATH setting. If you're using an application launcher like LaunchBar to start Visual Studio Code, your PATH variable will not be inherited.
Here is a system-wide fix:
In the /etc/paths.d directory, create a file with your Unix username. In that file, place the additional paths that Visual Studio Code needs to work. In my case, this is the contents of my /etc/paths.d file:
/usr/ucb
/opt/local/bin
/opt/local/sbin
~/go/bin
Note: Your /etc/paths.d file will be processed system-wide. Since most systems are single-user, this shouldn't be a problem for most developers.
Since this is the top Google search result for variants of "VS Code path", I will add my answer here.
I'm running Linux and my problem was that VS Code couldn't find some executable needed to build my project. I was running VS Code from the quick launcher (ALT+F2), and not from a Terminal. I tried modifying the PATH variable in many different places, but I couldn't seem to get it right.
In the end, placing the right PATH inside of ~/.zshenv is what worked. It's because .zshenv is the only file that gets sourced for non-interactive shell command execution like from inside of VS Code (more detailed explanation here https://unix.stackexchange.com/questions/71253/what-should-shouldnt-go-in-zshenv-zshrc-zlogin-zprofile-zlogout )
This was even easier to fix than the above answers suggested.
Open VSCode Settings (Ctrl + ,) and search for terminal.defaultProfile.
I updated my Terminal > Integrated > Default Profile: Windows.
It was set to null by default. As soon as I changed it to PowerShell and restarted the terminal, it picked up my system's path variables!
What did the trick in my case (Linux Mint 19.3 Cinnamon, VS code installed via snap) was to put my appended PATH in ~/.profile . Since this file is read at the beginning of a user session, don't forget to logout/login or reboot after editing this file.
I'm working with ubuntu 18.04. I had a similar problem, my enviroment variables were defined and the terminal knows the $PATH but when I tried to debug with golang, go libraries were not found in $PATH variable.
So, to solve it I uninstall the default version from ubuntu software and install manually using the following instructions:
https://code.visualstudio.com/docs/setup/linux
It works for me.
As of VS Code v1.63.2, you can proceed with Ctrl + Shift + P and then type Open Settings (JSON), and simply add the following line.
"terminal.integrated.inheritEnv": true
In my case the code was already there, but set to false. After changing it, everything was fine.
Getting Code to load your existing ~/.bash_profile would be best. I think the docs here are the relevant reference:
https://code.visualstudio.com/docs/editor/integrated-terminal#_linux-os-x
Typically $SHELL is your primary shell on Unix-like systems so you
probably won't want to change the shell. You can pass arguments to the
shell when it is launched.
For example, to enable running bash as a login shell (which runs
.bash_profile), pass in the -l argument (with double quotes):
// Linux "terminal.integrated.shellArgs.linux": ["-l"]
// OS X "terminal.integrated.shellArgs.osx": ["-l"]
Although, it looks like that setting is the default on my current VS Code (OS X) setup. Integrated terminal is running my ~/.bash_profile without any changes to the configuration. Perhaps try adding echo Executing .bash_profile... to test if it's running when a new terminal is opened in Code.
Add the following to your ~/.bash_profile:
launchctl setenv PATH $HOME/.cargo/bin:$PATH:$HOME/bin
Or run a Bash script when needed, e.g.:
#!/bin/bash
set -Eeuxo pipefail
proj_path=$( cd $( dirname ${BASH_SOURCE[0]} ) && pwd )
launchctl setenv PATH $proj_path/bin:${PATH:-}
For me it's resolved by editing the .desktop file.
Originally I have
Exec=/usr/bin/code-oss --unity-launch %F
. Just changed to
Exec=zsh -c "source ~/.zshrc && /usr/bin/code-oss --unity-launch %F"
since I use zsh, instead of bash. But if you have the same problem with bash, simply replace zsh with bash. And shortcuts from your desktop environment should be fixed.

How do I set the "elm-format" path within VSCode?

How do I set the "elm-format" path within VSCode?
I receive the following error:
I then installed the executable:
How do I now point VSCode to the elm-format.exe path as the error suggests?
Do I add it to the Language Specific Settings for Elm below?
// Place your settings in this file to overwrite the default settings
{
"window.zoomLevel": 1,
"files.autoSave": "off",
"elm.formatOnSave": true,
"[elm]": {
}
}
The elm-format mechanism is pretty rudimentary, and works as follows:
1) install elm-format for your platform (from github, as you've indicated)
2) add it to your PATH environment variable (i.e. PATH environment variable of the operating system, nothing to do w/ VS Code, etc). The idea is that if you open a command prompt/shell and type elm-format the system should be able to find it
3) set elm.formatOnSave in VS Code (as you've already done)
Now when VS Code saves, if you've installed, say, the elm extension, it'll invoke the elm-format command line utility (installed in 1 above)