VS Code Not Running Anything - No such file or directory - visual-studio-code

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

Related

Terminal will not open in 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.

No output when running Python 3 in VScode

I'm using Python 3.8 on VScode, but I can't seem to get the program to write anything in output, even with simple commands like: print("Hello world!"). It shows up in the terminal well enough, so the code shouldn't be the problem. Do i need to fix anything in the setting to make it show the output?
1: Picture of terminal:
Please could you check your user settings.json and workspace settings.json for the existence of a setting for terminal.integrated.shell.*.
I believe you may have changed the shell to use command prompt instead of powershell.
Also, please could you provide some screenshots of the terminal
And any errors logged in the console widows (go to Help->Toggle Developer Tools)

How to integrate Cmder properly in VS Code?

I would like to integrate Cmder shell into my VS Code configuration.
I'm using VS Code 64bit on Windows, and I tried to modify my settings.json file as follows, to make Cmder work as the integrated terminal:
"terminal.integrated.shell.windows": "C:\\Program Files\\Cmder\\Cmder.exe",
I restarted my VS Code and tried to open the terminal.
At first, this error message box showed up:
Failed to copy ConEmu.xml file to backup location!
Restart Cmder as administrator.
So, I launched VS Code as administrator, which made the error message disappear; however, I noticed that VS Code opens Cmder in another separate window instead of in the terminal.
How can I run Cmder shell inside VS Code terminal?
P.S. Could this note in vs code documentation be the solution?
Tip: The integrated terminal shell is running with the permissions of VS Code. If you need to run a shell command with elevated (administrator) or different permissions, you can use platform utilities such as runas.exe within a terminal."
from: https://code.visualstudio.com/docs/editor/integrated-terminal
There is a mistake in your configuration file, the following is not valid:
"terminal.integrated.shell.windows": "C:\\Program Files\\Cmder\\Cmder.exe"
You should not be calling Cmder.exe from the VS Code, instead, you should use init.bat (from the instructions below) to integrate Cmder in VS Code.
Your issue has been already explained here over the Cmder repository.
Making Cmder work in VS Code
Make sure you're on the latest release of Cmder – download latest here
Open the settings.json configuration file, by pressing Ctrl + , (Control-Comma) to access the preferences, then click on the Edit in settings.json link
VS Code documentation explains the process in this link:
Can I use Cmder's shell with the terminal on Windows?
Yes, to use the Cmder shell in VS Code, you need to add the following settings to your settings.json file:
"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\cmd.exe",
"terminal.integrated.shellArgs.windows": ["/K", "C:\\cmder\\vendor\\init.bat"]
BTW, You need to replace C:\\cmder with your own installation path.
Tip: replace single backslashes (\) with double backslashes (\\).
Make sure you read the notice at the official Cmder wiki:
👉 Please note the use of cmd.exe instead of cmder.exe.
Tip: refer to here on notes about handling spaces in your path.
TL;DR: It's not recommended by the Cmder team, but you may use ^ character before spaces to handle the paths.
You don't need to restart VS Code to make this work.
Hit Ctrl + ` (Control-Tilde) to open Cmder in VS Code terminal!
You may refer to my answer here for a complete explanation of how this works.
Related
There are similar issues over the VS Code repo and here on Cmder repo as well.
Cmder 1.3.12 introduced a vscode_init.cmd script which allows VS Code tasks to work correctly with Cmder.
The documentation in VS Code, referred to in the answer above, is out of date if you're using a version of Cmder greater than 1.3.11.
The Cmder GitHub repository now has extensive documentation on how to achieve integration between Cmder and VS Code. At the time of writing this message, it is more accurate than the VS Code documentation.
This worked for me on June 22nd 2021; add these lines to the settings.json file in your user settings (for me « C:\Users\ianla\AppData\Roaming\Code\User\settings.json »):
"terminal.integrated.profiles.windows": {
"cmder": {
"path": "C:\\WINDOWS\\System32\\cmd.exe",
"args": ["/K", "C:\\Users\\ianla\\cmder\\vendor\\bin\\vscode_init.cmd"]
}
},
"terminal.integrated.defaultProfile.windows": "cmder",
... of course, you'll need to change my « C:\Users\ianla\ » with your instalation "cmder" instalation path.
See here for more info
The following is that worked for me (version of Cmder greater than 1.3.11):
Paste \cmder directory into C:\tools
Paste in .vscode\settings.json :
"terminal.integrated.shell.windows": "cmd.exe",
"terminal.integrated.env.windows": {
"CMDER_ROOT": "C:\\tools\\cmder"
},
"terminal.integrated.shellArgs.windows": [
"/k",
"%CMDER_ROOT%\\vendor\\bin\\vscode_init.cmd"
],
.. and enjoy!

How to Integrate babun shell in VS code

I have tried changing the settings for "terminal.integrated.shell.windows" to babun mintty location. But the babun shell window opens separately and doesn't integrate with the VS code. Anyone knows how to achieve this?
After trying for 2 hours finally made it work.
Before reading my way of doing this, you might want to got through this issue first.
By default babun is installed in C:\Users\13000\.babun\. So we can configure it by overriding user setting in VS Code as:
"terminal.integrated.shell.windows": "C:\\Users\\YOURUSERNAME\\.babun\\cygwin\\bin\\zsh.exe",
After saving , reload the window and you are done.
You will get something like :
Hope this helps!
I was searching for any solution for this issue before and I could not find any. But I was curious how Babun itself run the command "Open Babun here" from right-click menu and noticed it runs this command:
C:\Users\YOURUSER\.babun\cygwin\bin\mintty.exe /bin/env CHERE_INVOKING=1 /bin/zsh.exe
I've tried setting mintty.exe as shell and using leading commands as shell arguments, but this method opens an external terminal. I've noticed this behavior is because using mintty.exe, so I replaced mintty.exe with env.exe itself. At last, these are the settings:
"terminal.integrated.shell.windows": "C:\\Users\\YOURUSER\\.babun\\cygwin\\bin\\env.exe",
"terminal.integrated.shellArgs.windows": [
"CHERE_INVOKING=1",
"/bin/zsh.exe"
]
Edit: This might not completely relate to this question, but because of having the similarity, I think it might worth mentioning.
During my search for a solution, I've seen many other questions about the same issue for integrating Atom's PlatformIO IDE Terminal package or JetBrain's IDEs with Babun's zsh.
In the case of Atom, setting the Shell Override to C:\Users\YOURUSER\.babun\cygwin\bin\env.exe and Shell Arguments to CHERE_INVOKING=1 /bin/zsh.exe opens zsh.exe as an integrated terminal in the project directory.
In the case of JetBrain, I've used WebStrom and this works:
cmd.exe "/k C:\Users\ehsan\.babun\cygwin\bin\env.exe CHERE_INVOKING=1 /bin/zsh.exe"
Just complementing the correct answer that Pramesh Bajracharya gave above, you can override user settings in VS Code opening the VS Code and going in:
File->Preferences->Settings
And then paste in the field shown in your right side (WORKSPACE SETTINGS):
{
"terminal.integrated.shell.windows": "C:\\Users\\YOURUSER\\.babun\\cygwin\\bin\\zsh.exe"
}
More information can be found in https://code.visualstudio.com/docs/editor/integrated-terminal
Thanks Pramesh Bajracharya!

How to open Visual Studio Code from the command line on linux?

I know I can use command "code" to open VS code or file, but I don't know what should I do to make it possible after I install VS code in Ubuntu.Thanks.
Launching from the Command Line
You can launch VS Code from the command line to quickly open a file, folder, or project. Typically, you open VS Code within the context of a folder. We find the best way to do this is to simply type:
code .
Tip: We have instructions for Mac users in our Setup topic that enable you to start VS Code from within a terminal. We add the VS Code executable to the PATH environment variable on Windows and Linux automatically during installation.
Sometimes you will want to open or create a file. If the specified files does not exist, VS Code will create them for you:
code index.html style.css readme.md
Tip: You can have as many file names as you want separated by spaces.
Source: https://code.visualstudio.com/Docs/editor/codebasics
So, there are a couple of solutions for this.
I've linked a video that shows you how to add vscode to $PATH
(which didn't work for me because I couldn't find the "shell:install path" command)
I uninstalled the vscode from my ubuntu and re-installed using sudo snap install --classic code
(This method worked for me)
Tell me which one works for you... and if you have extensions installed to your vscode then i guess you ought to make a backup or something.
Link to the video: https://youtu.be/iP5FKZXtDBs