feat(editor)!: accept autocomplete suggestion on Enter by default#194
Merged
Conversation
Closes #186. Adds an opt-in setting (Appearance → Editor → "Accept Suggestion with Enter") that lets Enter accept the active autocomplete suggestion alongside Tab, mapped to Monaco's "smart" mode so it only triggers when the suggestion actually changes the text. Default stays off to preserve current behaviour.
BREAKING CHANGE: Pressing Enter while an autocomplete suggestion is highlighted now accepts it instead of inserting a newline. Users who preferred the previous behaviour can turn it off under Appearance -> Editor -> "Accept Suggestion with Enter". This matches what most code editors do out of the box and is the behaviour users expect (issue #186).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #186.
What changes
The SQL editor had
acceptSuggestionOnEnter: 'off'hard-coded, so Enter always inserted a newline even when the autocomplete dropdown was open. This makes the behaviour configurable and flips the default to on, matching what most code editors do.'smart'mode rather than pure'on'— the suggestion is accepted only when it produces a textual change different from typing the character, which avoids the worst footgunseditorAcceptSuggestionOnEnterplumbed throughAppConfig(Rust) andSettings(TS)This is the headline change of the PR and worth calling out in the release notes:
The trade-off is conscious: the previous behaviour surprised most users (this is exactly what issue #186 was about), and IDE muscle memory expects Enter to confirm the suggestion. Existing users with custom
config.jsonkeep whatever they explicitly set; only the implicit default flips.Test plan
tsc --noEmit— cleancargo test --lib config::— 16 passed (incl. new assertions on the camelCase field and round-trip)vitest tests/components/ui/SqlEditorWrapper.test.tsx— 13 passed; 3 cases coverfalse → 'off',true → 'smart',undefined → 'smart'(new default)eslinton the changed files — cleanSELin the editor, confirm Enter acceptsSELECT; turn the toggle off, confirm Enter inserts a newline