A couple of autocomplete improvements (#1024)

* fix(tui): keep file suggestions open when typing in Tab-triggered mode

Previously, pressing Tab on an empty prompt or after a space would show
file suggestions, but typing a letter would dismiss them because the
text didn't look like a path pattern. Now the editor tracks whether
autocomplete was triggered via Tab (force mode) or naturally (regular
mode), and uses the appropriate suggestion method when updating.

* fix(tui): hide autocomplete when backspacing slash command to empty

Previously, typing / showed slash command suggestions, but pressing
Backspace to delete it showed file suggestions instead of hiding all
suggestions.
This commit is contained in:
Sviatoslav Abakumov 2026-01-29 05:48:09 +04:00 committed by GitHub
parent d57a26c88b
commit b54d689ec1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 152 additions and 56 deletions

View file

@ -312,9 +312,9 @@ export class CombinedAutocompleteProvider implements AutocompleteProvider {
return pathPrefix;
}
// Return empty string only if we're at the beginning of the line or after a space
// (not after quotes or other delimiters that don't suggest file paths)
if (pathPrefix === "" && (text === "" || text.endsWith(" "))) {
// Return empty string only after a space (not for completely empty text)
// Empty text should not trigger file suggestions - that's for forced Tab completion
if (pathPrefix === "" && text.endsWith(" ")) {
return pathPrefix;
}