Skip to content

Commit b4c9953

Browse files
authored
request folders/files when appropriate (microsoft#236370)
fix microsoft#236368
1 parent 639c4c8 commit b4c9953

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

extensions/terminal-suggest/src/terminalSuggestMain.ts

+11-10
Original file line numberDiff line numberDiff line change
@@ -328,16 +328,6 @@ export async function getCompletionItemsFromSpecs(specs: Fig.Spec[], terminalCon
328328
}
329329
}
330330
}
331-
const shouldShowCommands = !terminalContext.commandLine.substring(0, terminalContext.cursorPosition).trimStart().includes(' ');
332-
if (shouldShowCommands && (filesRequested === foldersRequested)) {
333-
// Include builitin/available commands in the results
334-
const labels = new Set(items.map(i => i.label));
335-
for (const command of availableCommands) {
336-
if (!labels.has(command)) {
337-
items.push(createCompletionItem(terminalContext.cursorPosition, prefix, command));
338-
}
339-
}
340-
}
341331

342332
const shouldShowResourceCompletions =
343333
(
@@ -351,6 +341,17 @@ export async function getCompletionItemsFromSpecs(specs: Fig.Spec[], terminalCon
351341
// and neither files nor folders are going to be requested (for a specific spec's argument)
352342
&& (!filesRequested && !foldersRequested);
353343

344+
const shouldShowCommands = !terminalContext.commandLine.substring(0, terminalContext.cursorPosition).trimStart().includes(' ');
345+
if (shouldShowCommands && (filesRequested === foldersRequested)) {
346+
// Include builitin/available commands in the results
347+
const labels = new Set(items.map(i => i.label));
348+
for (const command of availableCommands) {
349+
if (!labels.has(command)) {
350+
items.push(createCompletionItem(terminalContext.cursorPosition, prefix, command));
351+
}
352+
}
353+
}
354+
354355
if (shouldShowResourceCompletions) {
355356
filesRequested = true;
356357
foldersRequested = true;

0 commit comments

Comments
 (0)