Terminal will not open in Visual Studio Code - visual-studio-code

OS is linux.
Opening the terminal produces this error:
The terminal process failed to launch: Path to shell executable "bash" is not a file of a symlink.
The path to bash is correct in settings.json and the $PATH variable.
This is Visual Studio Code version 1.57.1. rolling back to an earlier version fixes the issue, so I made a bug report.

As jebeaudet said in his comment, edit the file
~/.config/Code/User/settings.json
and add this line
"terminal.integrated.profiles.linux": {"bash": {"path": "/bin/bash"}},
(in my case has occurs when upgrading from v1.55 to v1.60)

In my case, terminal.integrated.shell.linux wasn't set in settings.json which was causing the issue

I noticed the same problem since I upgraded to 1.57.1.
The problem shows up when I launch VSCODE from Gnome desktop or from the terminal without following the command code with a dot.
However if I enter "code ." then there is no problem.
I could not find "terminal.integrated.shell.linux" in the settings to set the path to the shell bash command.

Related

VS Code Not Running Anything - No such file or directory

My VS Code
My VSCode for Mac won't run even simple Python commands. For more context my Python Terminal execute in file dir setting is turned on. I don't know what the problem is, the play button or right clicking and selecting run code also doesn't do anything.
I've already ensured I have the proper VSCode installed for Mac. Please help :(
try to edit your settings.json file like this :
"terminal.explorerKind": "external",
"terminal.integrated.defaultProfile.windows": "Command Prompt"
learn more about using python in VS Code

Histfile in integrated terminal not the same as normal terminal

I just lost my terminal history in VS Code. I noticed it when trying to do a reverse search in the Integrated Terminal (CTRL+R).
To debug, I ran this command:
echo $HISTFILE
This gives me:
/var/folders/ky/ltbvkg9s1239m5c9bccj5xtc0000gn/T/johndoe-code-zsh/.zsh_history
I would expect the normal path of my ZSH history is shown instead, like I get in iTerm2 when running the same command.
/Users/johndoe/.zsh_history
I believe this is a bug with VSCode's ZSH shell integration, that has already been resolved on the Insiders version.
Here is the offending line (note the HISTFILE without $):
I've seen it merged into the release/1.74 branch so hopefully, a v1.74.1 is not too far away. In the meanwhile, you can switch to Insiders (side-by-side installation) or turn off shell integration as suggested in the other answer.
Try turning off the shell integration that's enabled by default ("terminal.integrated.shellIntegration.enabled") and then restart the terminal.
https://i.stack.imgur.com/1Ger0.png
I fixed the problem by just adding this two lines at the bottom of my ~/.zshrc file.
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8

VSC Prolog on MacOS Mojave error: "path to executable was not found"

I installed the VSC Prolog extension for Visual Studio code on MacOS Mojave. I get this error:
Cannot lint the prolog file. The Prolog executable was not found. Use the 'prolog.executablePath' setting to configure
In the settings for VSC Prolog i set the path to the executable to:
/Applications/SWI-Prolog.app/Contents/MacOS/swipl
I got this by typing which swipl in Terminal.
Any help is appreciated!
/JCR
Cmd Shift P(or windows alternative on VSCode)
Then type in
settings.json
Open up the settings.json file. Currently the README in the SWI-Prolog dmg says the directory to add to $PATH if installed in Applications is
"/Applications/SWI-Prolog.app/Contents/MacOS"
Therefore add the following line to your settings.json file
"prolog.executablePath": "/Applications/SWI-Prolog.app/Contents/MacOS"
Save the file and restart VSCode, hope this helps.

Visual Studio Code - "Shell Command: Install 'code' command in PATH command."

Consider:
I just started with Angular. I installed angular/cli and added a project.
Now I want to use Visual Studio Code.
I open the Command Palette (Ctrl + Shift + P) and type 'shell command' to find the shell command: Install 'code' command in PATH command.
But I get this message
"No commands matching"
Why does it not exist?
With Windows it is installed by default so you don't need to add path. Just run " code . " in cmd and it will work fine
If in Visual Studio Code doesn't appear that option and the installation didn't add to the path directly, you can add the Visual Studio Code bin folder manually to the path and it starts to work.
Go to the Enviroment Variables and edit the Path user variable.
Inside of it, add a new variable with the current bin path of your Visual Studio Code installation.
Mine, for example, is "C:\Users\Inazio\AppData\Local\Programs\Microsoft VS Code\bin"
After that, you can start to use the code command in your OS
I had this same problem. Long story short, I uninstalled VS Code, re-downloaded the installer package and ran that. Sure enough, one of the install screens has a checkbox option to add to the PATH variable and this option is unchecked by default.
Checked the box, finished the install, works fine.
Of course it's perfectly valid to modify the PATH variable after install, but I think it's important to clarify that (at least version 1.23.0) does not update PATH by default. Most of the threads I looked at says it does.
I fixed this just adding "C:\Users\myUser\AppData\Local\Programs\Microsoft VS Code\Code.exe" (where myUser is your windows user) without "" to system path.
same effect than " Shell Command: Install ‘code’ command in PATH ".
This works for me
For Windows users
Open Environment Variables
System > Advance system settings > Advanced tab > environment variables on system variables click on Path and click Edit and add new Path named
"C:\Users\Your-Username\AppData\Local\Programs\Microsoft VS Code\bin"
For window users follow steps below and add new Path, after doing so restart your terminal you will get code command on your terminal
If you already have Visual Code into Windows path and in a terminal you put "code ." and Visual Code starts, what happens is that the command "code" is not linked to the path in wsl2.
All you have to do is run the following command changing your user:
sudo ln -s /mnt/c/Users/CHANGE_USER/AppData/Local/Programs/Microsoft
VS\ Code/bin/code /usr/bin/code
This works on Ubuntu and Debian.
it is already installed on Windows. You just have to make cmd path where the project created (e.g C:\WINDOWS\system32> cd C:\WINDOWS\system32\hello-world), then run the the comamnd "code ." like this (C:\Windows\System32\hello-world>code .)
I got this from VS Code documentation
the path has been set automatically when installing VS.But i noticed a difference between "code." and "code ." Can you see the difference? The second has space in between the code and the dot. Try that.
I was having the same exact problem and when i checked my PATH variable it said that the path was something\something\Microsoft VS Code . then i remembered my folder's name was Visual Studio Code.After I renamed it back everything works.
Go to Extensions and install Shell. On newer versions you can just type in Code . in CMD and it will pop-up.
Just open your command prompt and type:
cd hello-world
hello-world is the project name don't forget to change it then click (enter) and type
code .
Visual Code already have internal terminal window
Use the Ctrl+` keyboard shortcut with the backtick character.
Its supports all Ubuntu terminal commands

VS Code doesn't add command line on path permanently on Mac

I am using VS code 1.8.1 on Mac 10.12.3 (16D32). After launch vscode, I run cmd shift p to open command search field. Then run Install code command in Path. I can see the code got added on PATH but it got removed after I close vs code. Is there a way to add it permanently?
So I've just had this issue during setup of a new laptop and found a simple (but slightly embarrassing) solution that worked for me. After faffing about with it for way too long I noticed I had left it in Downloads. I moved the .app file to /Applications and ran the command-line install function again and now the "code" command persists.
Add this to your ~/.bash_profile
export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
source: https://code.visualstudio.com/docs/setup/mac
I am assuming you've checked this link.
VSCode application generally resides in /Applications/Visual Studio Code.app/Contents/Resources/app/bin/code.
Follow these steps to access VSCode through code on shell.
Open bash_profile page
sudo vi /etc/paths
Add an extra line in the list of PATH folders as
/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/
Exit from vi: Esc > :wq! > Enter Key
Restart shell. Then do echo $PATH to confirm VSCode has been added successfully.
Check code command is added by typing which code. You should see VSCode path printed on screen.
Try this link if it doesn't work out.
Edit: I am using version 1.9.1 and after I ran Install code command in Path it got added permanently.
Visual Studio Code
rm /usr/local/bin/code
ln -s "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code" /usr/local/bin/code
Visual Studio Code - Insiders
rm /usr/local/bin/code-insiders
ln -s "/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/bin/code" /usr/local/bin/code-insiders
For Big Sur:
From the official docs:
Note: Since zsh became the default shell in macOS Catalina, run the
following commands to add VS Code to your path:
cat << EOF >> ~/.zprofile
# Add Visual Studio Code (code) export PATH="\$PATH:/Applications/Visual Studio
Code.app/Contents/Resources/app/bin" EOF
I did this and it worked for me.
I am running Visual Studio Code - Insiders 1.23.0 on a Mac/Mac OS 10.10.5 Yosemite. I added the "Shell Command: Install 'code-insiders' command in PATH" from within VSC - Insiders. From the terminal in any directory I just add 'code-insiders .' and it launches in VSC - Insiders without issue.
Hope that helps.
For me, the problem was that Visual Studio Code.app was not in the Applications folder, but rather in the Downloads folder. Moving it there and re-running the add to path command fixed it for me.