Skip to content

Autocomplete suggestions disappear when typing table name after 'from ' #4928

@pskrbasu

Description

@pskrbasu

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

  1. Run steampipe query to enter the interactive prompt
  2. Type select * from (with a trailing space)
  3. Observe that the autocomplete dropdown shows all connections and table names
  4. Type any character (e.g., a to start typing aws)
  5. 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+.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions