Fix autocomplete popover flicker
This commit is contained in:
@@ -168,7 +168,7 @@ function resolveAutocompleteIsLoading(args: {
|
||||
optionsLength: number;
|
||||
}): boolean {
|
||||
if (args.mode === "command") {
|
||||
return args.isCommandsLoading;
|
||||
return args.isCommandsLoading && args.optionsLength === 0;
|
||||
}
|
||||
if (args.mode === "file") {
|
||||
return (
|
||||
@@ -251,7 +251,7 @@ export function useAgentAutocomplete(input: UseAgentAutocompleteInput): AgentAut
|
||||
const isConnected = useHostRuntimeIsConnected(serverId);
|
||||
|
||||
const mode = resolveAutocompleteMode({ showFileAutocomplete, showCommandAutocomplete });
|
||||
const isVisible = resolveAutocompleteIsVisible({
|
||||
const canShowAutocomplete = resolveAutocompleteIsVisible({
|
||||
mode,
|
||||
canLoadCommands,
|
||||
serverId,
|
||||
@@ -270,6 +270,8 @@ export function useAgentAutocomplete(input: UseAgentAutocompleteInput): AgentAut
|
||||
draftConfig: queryDraftConfig,
|
||||
});
|
||||
|
||||
const isVisible = canShowAutocomplete && !(mode === "command" && isCommandsLoading);
|
||||
|
||||
const fileSuggestionsQuery = useQuery({
|
||||
queryKey: [
|
||||
"directorySuggestions",
|
||||
|
||||
Reference in New Issue
Block a user