File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed
Core/Sources/SuggestionService Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import Foundation
33import Preferences
44import SuggestionModel
55
6- final class CodeiumSuggestionProvider : SuggestionServiceProvider {
6+ actor CodeiumSuggestionProvider : SuggestionServiceProvider {
77 let projectRootURL : URL
88 let onServiceLaunched : ( SuggestionServiceType ) -> Void
99 var codeiumService : CodeiumSuggestionServiceType ?
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import GitHubCopilotService
33import Preferences
44import SuggestionModel
55
6- final class GitHubCopilotSuggestionProvider : SuggestionServiceProvider {
6+ actor GitHubCopilotSuggestionProvider : SuggestionServiceProvider {
77 let projectRootURL : URL
88 let onServiceLaunched : ( SuggestionServiceType ) -> Void
99 var gitHubCopilotService : GitHubCopilotSuggestionServiceType ?
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ public protocol SuggestionServiceType {
2727
2828protocol SuggestionServiceProvider : SuggestionServiceType { }
2929
30- public final class SuggestionService : SuggestionServiceType {
30+ public actor SuggestionService : SuggestionServiceType {
3131 let projectRootURL : URL
3232 let onServiceLaunched : ( SuggestionServiceType ) -> Void
3333 let providerChangeObserver = UserDefaultsObserver (
@@ -47,8 +47,10 @@ public final class SuggestionService: SuggestionServiceType {
4747 self . onServiceLaunched = onServiceLaunched
4848
4949 providerChangeObserver. onChange = { [ weak self] in
50- guard let self else { return }
51- suggestionProvider = buildService ( )
50+ Task { [ weak self] in
51+ guard let self else { return }
52+ await rebuildService ( )
53+ }
5254 }
5355 }
5456
@@ -66,6 +68,10 @@ public final class SuggestionService: SuggestionServiceType {
6668 )
6769 }
6870 }
71+
72+ func rebuildService( ) {
73+ suggestionProvider = buildService ( )
74+ }
6975}
7076
7177public extension SuggestionService {
You can’t perform that action at this time.
0 commit comments