Skip to content

Commit d1d6762

Browse files
authored
support builtin commands for git bash (microsoft#251216)
fix microsoft#248558
1 parent 0d63e9d commit d1d6762

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

extensions/terminal-suggest/src/terminalSuggestMain.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ for (const spec of upstreamSpecs) {
5858
const getShellSpecificGlobals: Map<TerminalShellType, (options: ExecOptionsWithStringEncoding, existingCommands?: Set<string>) => Promise<(string | ICompletionResource)[]>> = new Map([
5959
[TerminalShellType.Bash, getBashGlobals],
6060
[TerminalShellType.Zsh, getZshGlobals],
61+
[TerminalShellType.GitBash, getBashGlobals], // Git Bash is a bash shell
6162
// TODO: Ghost text in the command line prevents completions from working ATM for fish
6263
[TerminalShellType.Fish, getFishGlobals],
6364
[TerminalShellType.PowerShell, getPwshGlobals],
@@ -72,7 +73,11 @@ async function getShellGlobals(shellType: TerminalShellType, existingCommands?:
7273
if (!shellType) {
7374
return;
7475
}
75-
const options: ExecOptionsWithStringEncoding = { encoding: 'utf-8', shell: shellType };
76+
let execShellType = shellType;
77+
if (shellType === TerminalShellType.GitBash) {
78+
execShellType = TerminalShellType.Bash; // Git Bash is a bash shell
79+
}
80+
const options: ExecOptionsWithStringEncoding = { encoding: 'utf-8', shell: execShellType, windowsHide: true };
7681
const mixedCommands: (string | ICompletionResource)[] | undefined = await getShellSpecificGlobals.get(shellType)?.(options, existingCommands);
7782
const normalizedCommands = mixedCommands?.map(command => typeof command === 'string' ? ({ label: command }) : command);
7883
cachedGlobals.set(shellType, normalizedCommands);

0 commit comments

Comments
 (0)