-
Notifications
You must be signed in to change notification settings - Fork 325
Description
Bug Description
Autocomplete suggestions disappear as soon as the user starts typing a table name after from . For example, typing select * from shows all connections and tables, but typing select * from aws causes the dropdown to go blank.
Steps to Reproduce
- Run
steampipe queryto enter the interactive prompt - Type
select * from(with a trailing space) - Observe that the autocomplete dropdown shows all connections and table names
- Type any character (e.g.,
ato start typingaws) - Observe that the autocomplete dropdown disappears entirely
Expected Behavior
The autocomplete dropdown should remain visible and narrow down to show only matching suggestions (e.g., typing aws should filter to show aws_* tables and the aws schema).
Root Cause
This is a regression introduced in #4884 (commit 152420d, released in v2.3.3).
The fix for #4810 added an endsWithSpace check to isEditingTable() in pkg/interactive/interactive_helpers.go:
func isEditingTable(text string, prevWord string) bool {
endsWithSpace := len(text) > 0 && text[len(text)-1] == ' '
var editingTable = prevWord == "from" && endsWithSpace
return editingTable
}This condition causes isEditingTable to return false as soon as the user starts typing a table name (since the text no longer ends with a space). As a result, the queryCompleter in interactive_client.go returns no table suggestions, and the dropdown goes blank.
The previous behavior (v2.3.2 and earlier) only checked prevWord == "from", which correctly returned true while the user was typing the table name. The FilterHasPrefix call at the end of queryCompleter handled the narrowing/filtering of suggestions as the user typed.
The getPreviousWord() fix from the same PR was valid and should be kept — only the endsWithSpace guard needs to be reverted.
Affected Versions
- v2.3.3
- v2.3.4
Environment
Reported on Amazon Linux 2023, but reproducible on all platforms (macOS, Linux, etc.) running v2.3.3+.