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"
},
Related
I have recently been using a combination of CMake and NMake from the Build Tools for Visual Studio 2022 package. I would like to integrate that with VSCode's task system but it appears to not be using the environment I have set up.
If I run cmake -B build in a Visual Studio 2022 Developer PowerShell instance in Windows Terminal it will generate an makefile designed to be used with NMake as I have set the environment variable needed to do that by default. I have changed VSCode's default instance of PowerShell to use the same arguments on start up so now if I run cmake -B build in the default VSCode terminal I also get a makefile designed to be used with NMake.
The problem occurs when I try to make a tasks.json task that calls cmake -B build for me, instead of generating an NMake makefile it defaults to a Visual Studio project. When I tried to add -G NMake Makefiles to the task arguments it failed stating it couldn't find NMake. I assumed this was because the tasks doesn't call the same startup parameters that a terminal does so replicated the same config I used for changing the VSCode's default terminal to the
Dev version but it didn't fix the issue.
My task:
"label": "cmake_setup_debug",
"type": "process",
"command": "cmake",
"args": [
"-G",
"NMake Makefiles",
"-B",
"${workspaceFolder}/bin/debug"
],
"problemMatcher": [],
"options": {
"shell": {
"executable": "powershell.exe",
"args": [
"-noexit",
"-command",
"&{Import-Module 'C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/Common7/Tools/Microsoft.VisualStudio.DevShell.dll'; Enter-VsDevShell 0d22feab -SkipAutomaticLocation -DevCmdArguments -arch=x64}"
],
}
}
Is it possible to force a task to use a specific instance of powershell with all the needed start up parameters?
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.
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.
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.
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.