-
Notifications
You must be signed in to change notification settings - Fork 118
Add autocompleteBraces behavior setting #363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add autocompleteBraces behavior setting #363
Conversation
Adds a new 'autocompleteBraces' option to the Behavior configuration that
controls whether opening brackets automatically insert their closing pair.
When disabled, typing '{' will only insert '{' without the automatic '}'.
This enables downstream editors like CodeEdit to respect user preferences
for bracket auto-completion.
Changes:
- Add autocompleteBraces property to Behavior struct (default: true)
- Conditionally set up OpenPairFilter and DeletePairFilter based on setting
- Trigger setUpTextFormation when setting changes
0xWDG
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this 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 pull request adds a new autocompleteBraces configuration option to the Behavior struct that allows downstream editors like CodeEdit to control whether opening brackets automatically insert their closing pairs. This change addresses CodeEdit issue #1691 where the autocomplete braces setting was non-functional.
Changes:
- Added
autocompleteBracesboolean property toBehaviorstruct with default valuetruefor backward compatibility - Modified
setUpTextFormation()to conditionally set up bracket pair filters based on the setting value - Updated behavior change detection to trigger text formation reconfiguration when
autocompleteBraceschanges
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| Sources/CodeEditSourceEditor/SourceEditorConfiguration/SourceEditorConfiguration+Behavior.swift | Adds the autocompleteBraces property with default value, updates initializer, and triggers setUpTextFormation() when the setting changes |
| Sources/CodeEditSourceEditor/Controller/TextViewController+TextFormation.swift | Conditionally sets up OpenPairFilter and DeletePairFilter based on autocompleteBraces setting |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| /// Controls whether opening brackets automatically insert their closing pair. | ||
| /// When true, typing `{` will automatically insert `}` and position the cursor between them. | ||
| public var autocompleteBraces: Bool = true |
Copilot
AI
Feb 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new autocompleteBraces configuration setting lacks test coverage. While the test suite includes comprehensive tests for other behavior configuration options (like indentOption in test_indentBehavior), there are no tests verifying that:
- When
autocompleteBracesistrue, typing an opening bracket automatically inserts the closing bracket - When
autocompleteBracesisfalse, typing an opening bracket does not insert the closing bracket - Changing the setting from
truetofalseproperly removes the bracket pair filters - The delete pair behavior is properly controlled by this setting
Consider adding tests similar to the existing test_indentBehavior pattern that verify the bracket autocompletion behavior works correctly in both enabled and disabled states.
Summary
Adds a new
autocompleteBracesoption to theBehaviorconfiguration that controls whether opening brackets automatically insert their closing pair.This change enables downstream editors like CodeEdit to respect user preferences for bracket auto-completion (addresses CodeEdit issue #1691).
Changes
autocompleteBracesproperty toBehaviorstruct (default:truefor backward compatibility)OpenPairFilterandDeletePairFilterbased on settingsetUpTextFormation()when setting changesUsage in CodeEdit
After this PR is merged, CodeEdit can pass the user's preference:
Testing
autocompleteBraces: true(default){→ Should auto-insert}autocompleteBraces: false{→ Should only insert{Related