-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Description
The feature request
When Windows Terminal is a user's primary terminal, being able to open the repository in Git Bash via the Windows Terminal is sometimes preferable than opening a standalone Git Bash application. (See similar previous request: #14071)
Proposed solution
I think this is as simple as the following:
In enum Shell
, add:
WindowTerminalGitBash = 'Git Bash (via Windows Terminal)',
WindowTerminalPowerShell = 'PowerShell (via Windows Terminal)',
In shells/win32.ts
, in the following section of getAvailableShells
:
if (windowsTerminal != null) {
shells.push({
shell: Shell.WindowTerminal,
path: windowsTerminal,
})
}
Add two new shell definitions:
shells.push({
shell: Shell.WindowTerminalGitBash,
path: windowsTerminal,
extraArgs: ['-p "Git Bash"'],
})
shells.push({
shell: Shell.WindowTerminalPowerShell,
path: windowsTerminal,
extraArgs: ['-p "PowerShell"'],
})
And finally, in launch
, add two more cases to Shell.WindowTerminal
:
case Shell.WindowTerminal:
case Shell.WindowTerminalGitBash:
case Shell.WindowTerminalPowerShell:
And support extraArgs
:
return spawn(windowsTerminalPath, ['-d .', ...foundShell.extraArgs ?? []], { shell: true, cwd: path })
Note: Adding a profile to the args passed to wt doesn't actually do anything if the user has removed them from their Windows Terminal profiles list, so it's not going to cause errors for people. It'll just open the default command prompt profile.
Additional context
I've tested out the above code changes and they seem to work, here's a little demonstration of what it looks like:
Side note: If this gets approved, I can submit the changes as a pull request. Let me know!