mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-07 20:00:37 -07:00
Fix tests to wrap all calls changing the UI with act. (#12268)
This commit is contained in:
@@ -159,6 +159,7 @@ interface PerfectMatchResult {
|
||||
}
|
||||
|
||||
function useCommandSuggestions(
|
||||
query: string | null,
|
||||
parserResult: CommandParserResult,
|
||||
commandContext: CommandContext,
|
||||
getFzfForCommands: (
|
||||
@@ -207,7 +208,7 @@ function useCommandSuggestions(
|
||||
{
|
||||
...commandContext,
|
||||
invocation: {
|
||||
raw: `/${rawParts.join(' ')}`,
|
||||
raw: query || `/${rawParts.join(' ')}`,
|
||||
name: leafCommand.name,
|
||||
args: argString,
|
||||
},
|
||||
@@ -306,7 +307,13 @@ function useCommandSuggestions(
|
||||
|
||||
setSuggestions([]);
|
||||
return () => abortController.abort();
|
||||
}, [parserResult, commandContext, getFzfForCommands, getPrefixSuggestions]);
|
||||
}, [
|
||||
query,
|
||||
parserResult,
|
||||
commandContext,
|
||||
getFzfForCommands,
|
||||
getPrefixSuggestions,
|
||||
]);
|
||||
|
||||
return { suggestions, isLoading };
|
||||
}
|
||||
@@ -475,6 +482,7 @@ export function useSlashCompletion(props: UseSlashCompletionProps): {
|
||||
// Use extracted hooks for better separation of concerns
|
||||
const parserResult = useCommandParser(query, slashCommands);
|
||||
const { suggestions: hookSuggestions, isLoading } = useCommandSuggestions(
|
||||
query,
|
||||
parserResult,
|
||||
commandContext,
|
||||
getFzfForCommands,
|
||||
@@ -503,7 +511,11 @@ export function useSlashCompletion(props: UseSlashCompletionProps): {
|
||||
return;
|
||||
}
|
||||
|
||||
setSuggestions(hookSuggestions);
|
||||
if (isPerfectMatch) {
|
||||
setSuggestions([]);
|
||||
} else {
|
||||
setSuggestions(hookSuggestions);
|
||||
}
|
||||
setIsLoadingSuggestions(isLoading);
|
||||
setIsPerfectMatch(isPerfectMatch);
|
||||
setCompletionStart(calculatedStart);
|
||||
|
||||
Reference in New Issue
Block a user