Skip to content

Commit 2ba2dd5

Browse files
committed
Remove Unnecessary completionTriggerCharacters Configuration
1 parent 424453d commit 2ba2dd5

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

Sources/CodeEditSourceEditor/CodeSuggestion/Model/SuggestionTriggerCharacterModel.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,18 @@ import TextStory
1515
/// Was originally a `TextFilter` model, however those are called before text is changed and cursors are updated.
1616
/// The suggestion model expects up-to-date cursor positions as well as complete text contents. This being
1717
/// essentially a textview delegate ensures both of those promises are upheld.
18+
@MainActor
1819
final class SuggestionTriggerCharacterModel {
1920
weak var controller: TextViewController?
2021
private var lastPosition: NSRange?
2122

22-
var triggerCharacters: Set<String>? {
23-
controller?.configuration.peripherals.codeSuggestionTriggerCharacters
24-
}
25-
2623
func textView(_ textView: TextView, didReplaceContentsIn range: NSRange, with string: String) {
27-
guard let controller, let completionDelegate = controller.completionDelegate, let triggerCharacters else {
24+
guard let controller, let completionDelegate = controller.completionDelegate else {
2825
return
2926
}
3027

28+
let triggerCharacters = completionDelegate.completionTriggerCharacters()
29+
3130
let mutation = TextMutation(
3231
string: string,
3332
range: range,

Sources/CodeEditSourceEditor/SourceEditorConfiguration/SourceEditorConfiguration+Peripherals.swift

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,20 @@ extension SourceEditorConfiguration {
2828
/// non-standard quote character: `“ (0x201C)`.
2929
public var warningCharacters: Set<UInt16>
3030

31-
public var codeSuggestionTriggerCharacters: Set<String>
32-
3331
public init(
3432
showGutter: Bool = true,
3533
showMinimap: Bool = true,
3634
showReformattingGuide: Bool = false,
3735
showFoldingRibbon: Bool = true,
3836
invisibleCharactersConfiguration: InvisibleCharactersConfiguration = .empty,
39-
warningCharacters: Set<UInt16> = [],
40-
codeSuggestionTriggerCharacters: Set<String> = []
37+
warningCharacters: Set<UInt16> = []
4138
) {
4239
self.showGutter = showGutter
4340
self.showMinimap = showMinimap
4441
self.showReformattingGuide = showReformattingGuide
4542
self.showFoldingRibbon = showFoldingRibbon
4643
self.invisibleCharactersConfiguration = invisibleCharactersConfiguration
4744
self.warningCharacters = warningCharacters
48-
self.codeSuggestionTriggerCharacters = codeSuggestionTriggerCharacters
4945
}
5046

5147
@MainActor
@@ -83,10 +79,6 @@ extension SourceEditorConfiguration {
8379
controller.updateContentInsets()
8480
controller.updateTextInsets()
8581
}
86-
87-
if oldConfig?.codeSuggestionTriggerCharacters != codeSuggestionTriggerCharacters {
88-
controller.setUpTextFormation()
89-
}
9082
}
9183
}
9284
}

0 commit comments

Comments
 (0)