💄 Optimize and bug fixes in auto complete

This commit is contained in:
2025-10-14 22:26:06 +08:00
parent 8a6bb34808
commit af0ddd1273
2 changed files with 8 additions and 4 deletions

View File

@@ -149,9 +149,11 @@ class ComposeFormFields extends HookConsumerWidget {
final triggerIndex =
atIndex > colonIndex ? atIndex : colonIndex;
if (triggerIndex == -1) return [];
final chopped = pattern.substring(triggerIndex);
if (chopped.contains(' ')) return [];
final service = ref.read(autocompleteServiceProvider);
try {
return await service.getGeneralSuggestions(pattern);
return await service.getGeneralSuggestions(chopped);
} catch (e) {
return [];
}
@@ -235,7 +237,7 @@ class ComposeFormFields extends HookConsumerWidget {
direction: VerticalDirection.down,
hideOnEmpty: true,
hideOnLoading: true,
debounceDuration: const Duration(milliseconds: 500),
debounceDuration: const Duration(milliseconds: 1000),
),
],
),