Skip to content

Conversation

@pskrbasu
Copy link
Contributor

@pskrbasu pskrbasu commented Feb 6, 2026

Summary

Test plan

  • TestIsEditingTable — updated for reverted single-arg signature, added "table name after from" case
  • TestGetQueryInfo — added regression test cases: typing table name after from, typing partial table name, typing qualified table name, past table into where clause
  • TestGetQueryInfo_FromDetection — fixed expectations and added from_table_done case
  • All 68 tests in pkg/interactive/ pass
  • Manual verification: type select * from aws in interactive prompt and confirm suggestions filter correctly

🤖 Generated with Claude Code

…name after 'from ' closes #4928

Revert the `endsWithSpace` check in `isEditingTable()` that was introduced in
#4884. That check caused `isEditingTable` to return false as soon as the user
started typing a table name (e.g. `select * from aws`), because the text no
longer ended with a space. This made the autocomplete dropdown disappear
entirely instead of filtering suggestions by the typed prefix.

The original `prevWord == "from"` check is sufficient: while the user is typing
a table name, `prevWord` remains "from", so suggestions are shown and filtered
by `FilterHasPrefix`. Once the user finishes the table name and types a space
(moving to WHERE, etc.), `prevWord` becomes the table name, correctly stopping
table suggestions.

The `getPreviousWord()` fix from #4884 (handling single-word inputs like
"from ") is retained as it was correct.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a regression introduced in v2.3.3 where autocomplete suggestions disappear when users start typing a table name after from . The fix reverts the isEditingTable() function to rely on the simple prevWord == "from" check, allowing the existing FilterHasPrefix mechanism in queryCompleter to properly filter suggestions as users type.

Changes:

  • Reverted isEditingTable() to the pre-#4884 implementation that checks only prevWord == "from", removing the problematic endsWithSpace check
  • Updated all tests to match the single-argument signature of isEditingTable()
  • Added comprehensive regression test cases covering various scenarios of typing table names

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
pkg/interactive/interactive_helpers.go Simplified isEditingTable() to take only prevWord parameter and check prevWord == "from", removing the endsWithSpace guard that caused the regression
pkg/interactive/interactive_helpers_test.go Updated TestIsEditingTable to use single-argument signature and added test case for table name after from; added regression test cases to TestGetQueryInfo covering typing table names, partial names, and qualified names
pkg/interactive/interactive_client_test.go Updated TestGetQueryInfo_FromDetection with corrected expectations and added from_table_done test case; enhanced comments to reference both #4810 and #4928

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pskrbasu pskrbasu merged commit 791ea6f into v2.3.x Feb 6, 2026
34 checks passed
@pskrbasu pskrbasu deleted the fix/autocomplete-regression-4928 branch February 6, 2026 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants