Skip to content

feat: add autocompletion and multi-line for filter fields#525

Merged
datlechin merged 4 commits intomainfrom
feat/filter-autocompletion
Mar 31, 2026
Merged

feat: add autocompletion and multi-line for filter fields#525
datlechin merged 4 commits intomainfrom
feat/filter-autocompletion

Conversation

@datlechin
Copy link
Copy Markdown
Collaborator

Summary

  • Add native macOS autocompletion to filter text fields (Raw SQL and Value fields) — column names and SQL keywords suggested as user types
  • Add multi-line support for Raw SQL filter field (Option+Enter for newline, Enter to apply)
  • SQL keywords only suggested for SQL-based databases (SQL, CQL, PartiQL), not for MongoDB/Redis/etcd

Closes #521

Implementation

  • CompletionTextField (NSViewRepresentable) wrapping CompletionNSTextField with custom NSTextFieldCell that provides a CompletionFieldEditor (NSTextView subclass)
  • CompletionFieldEditor overrides completions(forPartialWordRange:indexOfSelectedItem:) for the native macOS completion popup
  • Auto-triggers on typing via fieldEditor.complete(nil) in controlTextDidChange
  • Follows existing CellTextField/CellTextFieldCell pattern in the codebase

Test plan

  • Open filter panel on a SQL database table, select Raw SQL mode, type partial column name → native completion popup appears
  • Select a column filter mode, type in Value field → column name suggestions appear
  • Connect to MongoDB/Redis → verify only column names suggested (no SQL keywords)
  • In Raw SQL mode, press Option+Enter → newline inserted; press Enter → filter applied
  • Verify completion popup keyboard: ↑↓ navigate, Enter/Tab select, Escape dismiss
  • Verify filter styling matches existing fields (size, font, border)

- Add @mainactor to FilterPresetStorage for Swift 6 concurrency safety
- Fix generatePreviewSQL hardcoded logicMode "and" — now respects AND/OR
- Fix getFiltersForPreview ignoring isEnabled flag
- Fix completion popup triggering on backspace (only trigger on text growth)
- Fix renamePreset creating duplicates (deduplicate by id first, then name)
- Fix sanitizeTableName key collisions (use percent-encoding)
- Add tooltip to preset column mismatch warning icon
@datlechin datlechin merged commit 589bea6 into main Mar 31, 2026
2 checks passed
@datlechin datlechin deleted the feat/filter-autocompletion branch March 31, 2026 05:33
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.

Suggestions in Filter

1 participant