Repository: microsoft/inshellisense (ts)

Issue:
PowerShell: Command history is not available using up and down arrows
When inside inshellisence, using up or down arrows will not bring up commands from the command history.

Applicable to PowerShell, not tested with bash or other shells.

Pull request description:
fix: empty suggestions block history scrolling
Closes #9 

Patch:
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 };


Test patch:
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`] = `
 {