diff --git a/src/runtime/runtime.ts b/src/runtime/runtime.ts index 1017d65..81e93f8 100644 --- a/src/runtime/runtime.ts +++ b/src/runtime/runtime.ts @@ -112,6 +112,7 @@ export const getSuggestions = async (cmd: string, cwd: string, shell: Shell): Pr } const result = await runSubcommand(activeCmd.slice(1), subcommand, resolvedCwd, shell); if (result == null) return; + if (result.suggestions.length == 0 && !result.argumentDescription) return; const charactersToDrop = lastCommand?.complete ? 0 : lastCommand?.tokenLength; return { ...result, charactersToDrop }; diff --git a/src/tests/runtime/__snapshots__/runtime.test.ts.snap b/src/tests/runtime/__snapshots__/runtime.test.ts.snap index 458e76b..52bd479 100644 --- a/src/tests/runtime/__snapshots__/runtime.test.ts.snap +++ b/src/tests/runtime/__snapshots__/runtime.test.ts.snap @@ -293,12 +293,7 @@ exports[`parseCommand completedOptionWithArg 1`] = ` } `; -exports[`parseCommand emptySuggestions 1`] = ` -{ - "charactersToDrop": 2, - "suggestions": [], -} -`; +exports[`parseCommand emptySuggestions 1`] = `undefined`; exports[`parseCommand exclusiveOnOption 1`] = ` { @@ -528,12 +523,7 @@ exports[`parseCommand noArgsArgumentGiven 1`] = ` } `; -exports[`parseCommand noOptionsSuggestedDuringVariadicArg 1`] = ` -{ - "charactersToDrop": 3, - "suggestions": [], -} -`; +exports[`parseCommand noOptionsSuggestedDuringVariadicArg 1`] = `undefined`; exports[`parseCommand optionsSuggestedAfterVariadicArg 1`] = ` {