Skip to content

fix(editor): favorite keyword autocomplete, Cmd+D shortcut, and selectable Details fields#1530

Merged
datlechin merged 2 commits into
mainfrom
fix/favorites-ux
Jun 1, 2026
Merged

fix(editor): favorite keyword autocomplete, Cmd+D shortcut, and selectable Details fields#1530
datlechin merged 2 commits into
mainfrom
fix/favorites-ux

Conversation

@datlechin

Copy link
Copy Markdown
Member

Three fixes from v0.47.0 feedback. Each goes at the root cause.

1. Field names in the Details panel are selectable

The row Details panel rendered the column name as a plain Text, which has no selection. Added the native .textSelection(.enabled) to the field header, so both the field name and the type badge can be selected and copied (double-click a word, ⌘C, right-click Copy). Scoped to this panel; the shared TypeBadge component is untouched.

2. Save as Favorite shortcut works again (Cmd+D) + toolbar button

0.47.0 moved the shortcut from Cmd+D to Control-Command-D to leave Cmd+D for the "Don't Save" sheet. But Control-Command-D is the macOS system "Look Up" shortcut, so the system swallowed it and the shortcut never fired (right-click still worked).

  • Default is back to Cmd+D, the standard bookmark/favorite idiom. It fires reliably, and it coexists with the modal "Don't Save" sheet the same way Safari does (the sheet's Cmd+D only applies while that sheet is open).
  • Added Control-Command-D to the system-reserved list so the settings conflict checker warns anyone who picks it.
  • Added a star button to the editor toolbar (reuses the existing save-favorite path, disabled when the query is empty), so favoriting is discoverable without the keyboard.

3. Favorite keyword expansion shows in autocomplete

A saved favorite's keyword was supposed to surface as an autocomplete suggestion, but never appeared. Root cause: in SQLCompletionProvider.getCandidates, favorites were appended at the top of the function, then discarded by the items = ... reassignment in most clause branches, including the .unknown branch that handles the start of a statement (the natural place to type a keyword).

Moved favorite injection into a favoriteCompletions(matching:) helper appended after the clause switch, so it survives every branch. The early-return dot-prefix path keeps favorites out of table.column completion. .favorite already ranks first, so the suggestion appears at the top of the popup with the favorite's name as its detail.

Tests

  • SQLCompletionProviderTests: keyword expands at statement start, survives clause rebuild, is excluded after a dot prefix, and requires a prefix match.
  • KeyboardShortcutTests: Cmd+D is the Save as Favorite default, Control-Command-D is system-reserved, and no default shortcut collides with a reserved combo.

Docs / changelog

  • docs/features/favorites.mdx and docs/features/keyboard-shortcuts.mdx updated for the new shortcut, the toolbar button, and clearer keyword usage.
  • CHANGELOG.md Unreleased: Added (toolbar button, selectable Details fields), Changed (Cmd+D), Fixed (keyword autocomplete).

Production files pass swiftlint lint --strict. The user builds in Xcode.

@datlechin datlechin merged commit 7fa77ad into main Jun 1, 2026
3 of 4 checks passed
@datlechin datlechin deleted the fix/favorites-ux branch June 1, 2026 06:00
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.

1 participant