@@ -5,17 +5,19 @@ public final class SuggestionProvider: ObservableObject {
55 @Published public var code : String = " " {
66 didSet { highlightedCode = nil }
77 }
8+
89 @Published public var language : String = " " {
910 didSet { highlightedCode = nil }
1011 }
12+
1113 @Published public var startLineIndex : Int = 0
1214 @Published public var suggestionCount : Int = 0
1315 @Published public var currentSuggestionIndex : Int = 0
1416 @Published public var commonPrecedingSpaceCount = 0
15-
17+
1618 private var colorScheme : ColorScheme = . light
17- private var highlightedCode : [ NSAttributedString ] ? = nil
18-
19+ private var highlightedCode : [ NSAttributedString ] ?
20+
1921 func highlightedCode( colorScheme: ColorScheme ) -> [ NSAttributedString ] {
2022 if colorScheme != self . colorScheme { highlightedCode = nil }
2123 self . colorScheme = colorScheme
@@ -24,15 +26,16 @@ public final class SuggestionProvider: ObservableObject {
2426 code: code,
2527 language: language,
2628 brightMode: colorScheme != . dark,
27- droppingLeadingSpaces: true
29+ droppingLeadingSpaces: UserDefaults . shared
30+ . value ( for: \. hideCommonPrecedingSpacesInSuggestion)
2831 )
2932 highlightedCode = new
3033 Task { @MainActor in
3134 commonPrecedingSpaceCount = spaceCount
3235 }
3336 return new
3437 }
35-
38+
3639 public var onSelectPreviousSuggestionTapped : ( ) -> Void
3740 public var onSelectNextSuggestionTapped : ( ) -> Void
3841 public var onRejectSuggestionTapped : ( ) -> Void
0 commit comments