address terminal completion provider API feedback (#270249)

commit api feedback
This commit is contained in:
Megan Rogge
2025-10-07 14:41:36 -04:00
committed by GitHub
parent ce3c3a3b19
commit d1d275ca09
14 changed files with 300 additions and 288 deletions

View File

@@ -91,11 +91,11 @@ suite('Terminal Suggest', () => {
}
test(`'${testSpec.input}' -> ${expectedString}`, async () => {
const commandLine = testSpec.input.split('|')[0];
const cursorPosition = testSpec.input.indexOf('|');
const currentCommandString = getCurrentCommandAndArgs(commandLine, cursorPosition, undefined);
const filesRequested = testSpec.expectedResourceRequests?.type === 'files' || testSpec.expectedResourceRequests?.type === 'both';
const foldersRequested = testSpec.expectedResourceRequests?.type === 'folders' || testSpec.expectedResourceRequests?.type === 'both';
const terminalContext = { commandLine, cursorPosition, allowFallbackCompletions: true };
const cursorIndex = testSpec.input.indexOf('|');
const currentCommandString = getCurrentCommandAndArgs(commandLine, cursorIndex, undefined);
const showFiles = testSpec.expectedResourceRequests?.type === 'files' || testSpec.expectedResourceRequests?.type === 'both';
const showFolders = testSpec.expectedResourceRequests?.type === 'folders' || testSpec.expectedResourceRequests?.type === 'both';
const terminalContext = { commandLine, cursorIndex, allowFallbackCompletions: true };
const result = await getCompletionItemsFromSpecs(
completionSpecs,
terminalContext,
@@ -118,8 +118,8 @@ suite('Terminal Suggest', () => {
}).sort(),
(testSpec.expectedCompletions ?? []).sort()
);
strictEqual(result.filesRequested, filesRequested, 'Files requested different than expected, got: ' + result.filesRequested);
strictEqual(result.foldersRequested, foldersRequested, 'Folders requested different than expected, got: ' + result.foldersRequested);
strictEqual(result.showFiles, showFiles, 'Show files different than expected, got: ' + result.showFiles);
strictEqual(result.showFolders, showFolders, 'Show folders different than expected, got: ' + result.showFolders);
if (testSpec.expectedResourceRequests?.cwd) {
strictEqual(result.cwd?.fsPath, testSpec.expectedResourceRequests.cwd.fsPath, 'Non matching cwd');
}