VS code intagrated terminal broken - visual-studio-code

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

Related

Can't debug Rust code inside vscode with WSL setup

I can't debug my rust code which is in WSL with VScode which is installed on my windows. I get these errors during debug.
Error: there is no registered task type 'codelldb.cargo'. Did you miss installing an extension that provides a corresponding task provider?
Error: there is no registered task type 'codelldb.cargo'. Did you miss installing an extension that provides a corresponding task provider?
Here is my launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug executable 'foo'",
"cargo": {
"args": [
"build",
"--bin=foo",
"--package=foo"
],
"filter": {
"name": "foo",
"kind": "bin"
}
},
"args": [],
"cwd": "${workspaceFolder}"
},
]
}
Strangely I can run my code using vscode & getting expected output.
I have installed below extension for WSL in vscode
codeLLDB
rust-analyzer
these are the versions of software
WSL: version 1
vscode: 1.72.2
windows : Windows 10
What I'm missing here
This issue is due to WSL version. Issue got fixed after upgrading WSL from v1 to v2

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

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.

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.

Task with 'runner' not working as expected in VS Code

In VS Code 1.13.1, running in Windows Creator Update, I have defined this task in tasks.json:
{
"version": "0.1.0",
"runner": "terminal",
"command": "echo",
"isShellCommand": true,
"args": ["Hello world"],
"showOutput": "always"
}
When I run the task I see this message in the integrated terminal:
Terminal will be reused by tasks, press any key to close it.
But I don't see "Hello world". Why?
I don't know if you solved it yet, but I was having the same problem until I changed the terminal on settings.json from
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
to
"terminal.integrated.shell.windows": "C:\\WINDOWS\\Sysnative\\cmd.exe"
If your settings.json file does not have this line you can add and see if the problem goes away.