Skip to content

Commit b0ace15

Browse files
committed
fix: incomplete commands in history
1 parent b254322 commit b0ace15

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/utils/completion.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,11 @@ async function getFrequentlyUsedProgramCompletions(query: string, cwd: string, c
298298
const getShellHistoryTokenLists = memoize(() => {
299299
const history = uniq((shellHistory() as string[]).reverse()).slice(0, 100)
300300
return history.map(line => {
301-
return parse(line)
302-
.filter((item): item is string => (typeof item === 'string' && Boolean(item)))
301+
try {
302+
return parse(line).filter((item): item is string => (typeof item === 'string' && Boolean(item)))
303+
} catch {
304+
return []
305+
}
303306
})
304307
})
305308

0 commit comments

Comments
 (0)