Fix terminal-suggest completions showing up in Python REPLs

Co-authored-by: Tyriar <2193314+Tyriar@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-08-05 22:16:12 +00:00
parent d56fdd2279
commit 790b11d056
2 changed files with 24 additions and 4 deletions

View File

@@ -6,7 +6,7 @@
import { deepStrictEqual, strictEqual } from 'assert';
import 'mocha';
import { basename } from 'path';
import { asArray, getCompletionItemsFromSpecs, getCurrentCommandAndArgs } from '../terminalSuggestMain';
import { asArray, getCompletionItemsFromSpecs, getCurrentCommandAndArgs, getTerminalShellType, TerminalShellType } from '../terminalSuggestMain';
import { getTokenType } from '../tokens';
import { cdTestSuiteSpec as cdTestSuite } from './completions/cd.test';
import { codeSpecOptionsAndSubcommands, codeTestSuite, codeTunnelTestSuite } from './completions/code.test';
@@ -149,3 +149,23 @@ class MockFigExecuteExternals implements IFigExecuteExternals {
}
}
suite('Shell Type Filtering', () => {
test('getTerminalShellType should return appropriate shell types for supported shells', () => {
strictEqual(getTerminalShellType('bash'), TerminalShellType.Bash);
strictEqual(getTerminalShellType('zsh'), TerminalShellType.Zsh);
strictEqual(getTerminalShellType('fish'), TerminalShellType.Fish);
strictEqual(getTerminalShellType('pwsh'), TerminalShellType.PowerShell);
strictEqual(getTerminalShellType('gitbash'), TerminalShellType.GitBash);
});
test('getTerminalShellType should return undefined for Python REPLs', () => {
strictEqual(getTerminalShellType('python'), undefined, 'Python REPLs should not receive terminal-suggest completions');
});
test('getTerminalShellType should return undefined for unsupported shells', () => {
strictEqual(getTerminalShellType('unsupported'), undefined);
strictEqual(getTerminalShellType(undefined), undefined);
strictEqual(getTerminalShellType(''), undefined);
});
});