Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ extension TextViewController {

// Filters

setUpOpenPairFilters(pairs: BracketPairs.allValues)
if configuration.behavior.autocompleteBraces {
setUpOpenPairFilters(pairs: BracketPairs.allValues)
setUpDeletePairFilters(pairs: BracketPairs.allValues)
}
setUpTagFilter()
setUpNewlineTabFilters(indentOption: configuration.behavior.indentOption)
setUpDeletePairFilters(pairs: BracketPairs.allValues)
setUpDeleteWhitespaceFilter(indentOption: configuration.behavior.indentOption)

}

/// Returns a `TextualIndenter` based on available language configuration.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ extension SourceEditorConfiguration {
/// false, the editor is selectable but not editable.
public var isSelectable: Bool = true

/// Controls whether opening brackets/braces are automatically completed with their closing counterpart.
public var autocompleteBraces: Bool = true

/// Determines what character(s) to insert when the tab key is pressed. Defaults to 4 spaces.
public var indentOption: IndentOption = .spaces(count: 4)

Expand All @@ -23,11 +26,13 @@ extension SourceEditorConfiguration {
public init(
isEditable: Bool = true,
isSelectable: Bool = true,
autocompleteBraces: Bool = true,
indentOption: IndentOption = .spaces(count: 4),
reformatAtColumn: Int = 80
) {
self.isEditable = isEditable
self.isSelectable = isSelectable
self.autocompleteBraces = autocompleteBraces
self.indentOption = indentOption
self.reformatAtColumn = reformatAtColumn
}
Expand All @@ -48,7 +53,7 @@ extension SourceEditorConfiguration {
controller.textView.isSelectable = isSelectable
}

if oldConfig?.indentOption != indentOption {
if oldConfig?.indentOption != indentOption || oldConfig?.autocompleteBraces != autocompleteBraces {
controller.setUpTextFormation()
}

Expand Down