@@ -328,16 +328,6 @@ export async function getCompletionItemsFromSpecs(specs: Fig.Spec[], terminalCon
328
328
}
329
329
}
330
330
}
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
- }
341
331
342
332
const shouldShowResourceCompletions =
343
333
(
@@ -351,6 +341,17 @@ export async function getCompletionItemsFromSpecs(specs: Fig.Spec[], terminalCon
351
341
// and neither files nor folders are going to be requested (for a specific spec's argument)
352
342
&& ( ! filesRequested && ! foldersRequested ) ;
353
343
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
+
354
355
if ( shouldShowResourceCompletions ) {
355
356
filesRequested = true ;
356
357
foldersRequested = true ;
0 commit comments