mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 19:18:59 +01:00
Fix terminal-suggest completions showing up in Python REPLs
Co-authored-by: Tyriar <2193314+Tyriar@users.noreply.github.com>
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user