diff --git a/extensions/terminal-suggest/src/terminalSuggestMain.ts b/extensions/terminal-suggest/src/terminalSuggestMain.ts index 51e1f12be13..8775a1650e1 100644 --- a/extensions/terminal-suggest/src/terminalSuggestMain.ts +++ b/extensions/terminal-suggest/src/terminalSuggestMain.ts @@ -363,6 +363,7 @@ export async function getCompletionItemsFromSpecs( } } + let hasCurrentArg = false; for (const spec of specs) { const specLabels = getLabel(spec); @@ -407,7 +408,7 @@ export async function getCompletionItemsFromSpecs( { environmentVariables: env, currentWorkingDirectory: shellIntegrationCwd.fsPath, sshPrefix: '', currentProcess: name, /* TODO: pass in aliases */ }, spec, ); - + hasCurrentArg ||= !!parsedArguments.currentArg; const completionItemResult = await collectCompletionItemResult(command, parsedArguments, prefix, terminalContext, items); if (completionItemResult) { filesRequested ||= completionItemResult.filesRequested; @@ -426,7 +427,7 @@ export async function getCompletionItemsFromSpecs( } filesRequested = true; foldersRequested = true; - } else if (!items.length && !filesRequested && !foldersRequested) { + } else if (!items.length && !filesRequested && !foldersRequested && !hasCurrentArg) { // Not a command and no specific args or options were provided, so show resources filesRequested = true; foldersRequested = true; diff --git a/extensions/terminal-suggest/src/test/completions/code.test.ts b/extensions/terminal-suggest/src/test/completions/code.test.ts index 25f4326481d..b9cb0eb5ccc 100644 --- a/extensions/terminal-suggest/src/test/completions/code.test.ts +++ b/extensions/terminal-suggest/src/test/completions/code.test.ts @@ -35,9 +35,9 @@ export function createCodeTestSpecs(executable: string): ITestSpec[] { { input: `${executable} --merge ./file1 ./file2 ./base |`, expectedResourceRequests: { type: 'files', cwd: testPaths.cwd } }, { input: `${executable} --goto |`, expectedResourceRequests: { type: 'files', cwd: testPaths.cwd } }, { input: `${executable} --user-data-dir |`, expectedResourceRequests: { type: 'folders', cwd: testPaths.cwd } }, - { input: `${executable} --profile |`, expectedResourceRequests: { type: 'both', cwd: testPaths.cwd } }, - { input: `${executable} --install-extension |`, expectedResourceRequests: { type: 'both', cwd: testPaths.cwd } }, - { input: `${executable} --uninstall-extension |`, expectedResourceRequests: { type: 'both', cwd: testPaths.cwd } }, + { input: `${executable} --profile |` }, + { input: `${executable} --install-extension |` }, + { input: `${executable} --uninstall-extension |` }, { input: `${executable} --log |`, expectedCompletions: logOptions }, { input: `${executable} --sync |`, expectedCompletions: syncOptions }, { input: `${executable} --extensions-dir |`, expectedResourceRequests: { type: 'folders', cwd: testPaths.cwd } },