In vs code terminal only cmd shows up in the drop down - visual-studio-code

In vs code terminal only cmd shows up in the drop down. I used to have PowerShell, Git Bash, etc. Any idea what happened and how I can fix it?
My VS Code version information is:
Version: 1.27.1 (user setup)
Commit: 5944e81f3c46a3938a82c701f96d7a59b074cfdc
Date: 2018-09-06T09:21:18.328Z
Electron: 2.0.7
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
Architecture: x64
I noticed that my C:\Users\YourLegalId\AppData\Roaming\Code\User\settings.json file looked like:
{
"editor.largeFileOptimizations": false,
"editor.renderControlCharacters": true,
"terminal.integrated.shell.windows": "C:\\windows\\System32\\cmd.exe"
}
I asked coworker what theirs looked like and he said his was empty. I tried emptying min out and then I only see PowerShell!

You can tweak the drop down menu by adding these lines to your settings.json and modify them as you see fit:
// The Windows profiles to present when creating a new terminal via the terminal dropdown.
// Use the `source` property to automatically detect the shell's location.
// Or set the `path` property manually with an optional `args`.
//
// Set an existing profile to `null` to hide the profile from the list,
//for example: `"Ubuntu-20.04 (WSL)": null`.
"terminal.integrated.profiles.windows": {
"PowerShell": {
"source": "PowerShell",
"icon": "terminal-powershell"
},
"Command Prompt": {
"path": [
"${env:windir}\\Sysnative\\cmd.exe",
"${env:windir}\\System32\\cmd.exe"
],
"args": [],
"icon": "terminal-cmd"
},
"Git Bash": {
"source": "Git Bash"
}
},
Then, you can choose your default shell by adding this line:
"terminal.integrated.defaultProfile.windows": "PowerShell",

The version that I had 1.27.1 was quite old, even though Help > Check for Updates showed no updates available. I downloaded a new VS code from Microsoft's website and ran it. I was upgraded to version 1.63.2 and it fixed my command prompt issues.

Related

VS code intagrated terminal broken

My integrated terminal doesn't work. I have no functional terminal. I can't create new one. When I click on the plus button, nothing append. And I don't have any terminal profile in the dropdown list.
dropdown list
I added some profiles in my settings file, but it seems they are not recognized.
{
"workbench.colorTheme": "Default Dark+",
"terminal.integrated.profiles.windows": {
"PowerShell": {
"source": "PowerShell",
"icon": "terminal-powershell"
},
"Command Prompt": {
"path": [
"${env:windir}\\Sysnative\\cmd.exe",
"${env:windir}\\System32\\cmd.exe"
],
"args": [],
"icon": "terminal-cmd"
},
"Git Bash": {
"source": "Git Bash"
}
},
"terminal.integrated.defaultProfile.windows": "Command Prompt",
}
I tried to uninstall vs code, remove all folders and reinstall vs code but I have the same issue.
I have this same issue; for now, I installed version 1.59 which fixed my problem: https://code.visualstudio.com/updates/v1_59
I'd be interested in learning if there's a better fix, or if a bug report has been filed.
I added
"terminal.integrated.useWslProfiles": false
to my settings and it solved my problem.
There is an issue about that on Github. https://github.com/microsoft/vscode/issues/134418

Visual Studio Code Debugger not launching

OS and Version: Windows 10 Build 19042.985
VS Code Version: 1.56.2
C/C++ Extension Version: v1.4.0-insiders
other extensions: remote-ssh
I've been working with remote-ssh on a raspberry and c/c++ extension without any issue, all of a sudden I cannot start the debugger. Nothing changed, configuration files are the same as before but now when I start the debugger, I see for a couple of seconds the top debugging bar and then it disappears. No message on the console, nothing.
For this purpose, I created a simple project from scratch, and even there, the same issue appears.
To Reproduce
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/a.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"logging": { "engineLogging": true },
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": false
}
]
}
]
}
main.c
#include <stdio.h>
int main(){
printf("ciao\n");
return 1;
}
Compile with gcc -g main.c
As I stated before, this workflow worked for me, from one second to another it stopped working as intended and I have no idea why and how to fix it, any help is appreciated.
What I tried
reinstall vscode
reinstall the c/c++ extension and delete by hand the extension folder
numerous reboots
Updates
I have tried with the wsl-remote extension and it is working as expected.ù
Tried to uninstall gdb from host and launch the debug session, the message "gdb" not found does not even appear as it should
I was in similar situation and couldn't find relevant resolutions:
Quick Answer:
After upgrade to VS Code 1.56.2, make sure to remove old breakpoints and create new breakpoint and at-least have 1 breakpoint and launch.json available.
Lengthy details:
I have similar issue for python scripts when I start the "debugger bar" I see it for a couple of seconds the top debugging bar and then it disappears. Bu then no message on the console, nothing. I tried reinstalling VS Code, enabling/disabling extension, various restart.
OS and Version: Mac OSX Version 11.4 (20F71)
VS Code Version: 1.56.2
Extension: Python v2021.5.842923320 by Microsoft
RootCause:
What I did know for sure that I updated my VS Code, and after that this mysterious issue start happening, so when to release log of VS Code 1.56.2. I found below release log
Debug view displayed on break#
The default value of the debug.openDebug setting is now
openOnDebugBreak so that on every breakpoint hit, VS Code will open
the Debug view. The Debug view is also displayed on first session
start.
So VS code Version 1.56 release, debugger will only show when at-least 1 breakpoint is found. However, looks like there is issue with their internal code checking for historical breakpoint data after VS Code upgrade..
https://code.visualstudio.com/updates/v1_56#_debug-view-displayed-on-break
I had this same issue in python. The fix for python was changing to a valid interpreter due to a python library not being installed. Make sure that the interpreter is correct and then try again.
This may be caused by a faulty installation of the VS Code C/C++ extension. When launching VS Code, if the message "Unable to start the C/C++ language server. IntelliSense features will be disabled" appears, this is probably the cause. Was able to fix the installation in this case by installing a previous version of the C/C++ extension as per this answer.
I had the same problem (though the debug bar would show up for a second and then disappear). I was using a conda env with python 3.6. I updated to 3.8, with the same dependencies, and it started working.

Getting "bash: XXX: command not found" in VS Code terminal

I am getting this error on my VS Code terminal. I have tried reinstalling the IDE but it did not go away. I am using Linux mint.
This VScode issue they say "By default the VS Code integrated terminal does not run as a login shell".
As this is n answer from 2016, the option they give is deprecated.
The problem I has is running the terminal in WSL environment and what worked for me is to add the following to my setting.json:
{
"terminal.integrated.profiles.linux": {
"bash": {
"path": "bash",
"icon": "terminal-bash",
"args": [
"--login"
]
}
}
}
You then need to delete the open terminal (the dustbin icon) and reopen. Or just restart VScode.

Using git-bash with visual studio code

I normally use git-bash.exe on Windows 10 but visual studio code seems to use bash.exe. bash.exe seems very limited :(
I am trying to either get bash.exe to be more useful or get git-bash.exe to run in the terminal at the bottom of the screen.
Any suggestions?
// this opens the terminal window at the bottom of code
// but as I said, seems limited.
{
"shell": "C:\\Program Files\\Git\\bin\\bash.exe",
"label": "Git bash"
}
// the problem with this is it opens a new window when
// run and I would prefer it be at the bottom.
{
"shell": "C:\\Program Files\\Git\\git-bash.exe",
"label": "Git bash"
},

VSCode - how to keybind an external command

Im trying to run "puppet-lint -f (currently open file)
The Puppet extenstion provides puppet-lint check, but doesnt auto fix any issues, it just gives warnings. How can I add a keyboard shortcut to run "puppet-lint -f" on a file Im currently editing?
Thanks
I don't know anything about the Puppet extension but in general here is how you can bind a shell command to a keychord:
Make a task for it (.vscode/tasks.json):
{
"version": "2.0.0",
"tasks": [{
"label": "node version",
"command": "node",
"args": [
"-v"
],
"type": "shell"
}]
}
In the args you may use ${file} for the current file.
Then add this option to your keybindings.json (you can find them in Command Palette under “Preferences: Open keyboard shortcuts (JSON)”):
{
"key": "shift+escape",
"command": "workbench.action.tasks.runTask",
"args": "node version"
},
co-author of the extension here. You can have the Puppet VSCode Extension run puppet-lint fix on the current file by using the Format Document command. You can then configure VSCode to run format on save.