Skip to content

Commit 19fc284

Browse files
authored
fix: empty suggestions block history scrolling (#347)
* fix: empty suggestions block history scrolling Signed-off-by: Chapman Pendery <[email protected]> * fix: snapshot Signed-off-by: Chapman Pendery <[email protected]> --------- Signed-off-by: Chapman Pendery <[email protected]>
1 parent 5c79ed8 commit 19fc284

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

src/runtime/runtime.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ export const getSuggestions = async (cmd: string, cwd: string, shell: Shell): Pr
112112
}
113113
const result = await runSubcommand(activeCmd.slice(1), subcommand, resolvedCwd, shell);
114114
if (result == null) return;
115+
if (result.suggestions.length == 0 && !result.argumentDescription) return;
115116

116117
const charactersToDrop = lastCommand?.complete ? 0 : lastCommand?.tokenLength;
117118
return { ...result, charactersToDrop };

src/tests/runtime/__snapshots__/runtime.test.ts.snap

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -293,12 +293,7 @@ exports[`parseCommand completedOptionWithArg 1`] = `
293293
}
294294
`;
295295

296-
exports[`parseCommand emptySuggestions 1`] = `
297-
{
298-
"charactersToDrop": 2,
299-
"suggestions": [],
300-
}
301-
`;
296+
exports[`parseCommand emptySuggestions 1`] = `undefined`;
302297

303298
exports[`parseCommand exclusiveOnOption 1`] = `
304299
{
@@ -528,12 +523,7 @@ exports[`parseCommand noArgsArgumentGiven 1`] = `
528523
}
529524
`;
530525

531-
exports[`parseCommand noOptionsSuggestedDuringVariadicArg 1`] = `
532-
{
533-
"charactersToDrop": 3,
534-
"suggestions": [],
535-
}
536-
`;
526+
exports[`parseCommand noOptionsSuggestedDuringVariadicArg 1`] = `undefined`;
537527

538528
exports[`parseCommand optionsSuggestedAfterVariadicArg 1`] = `
539529
{

0 commit comments

Comments
 (0)