File tree Expand file tree Collapse file tree 4 files changed +9
-16
lines changed
Core/Sources/Service/WorkspaceExtension Expand file tree Collapse file tree 4 files changed +9
-16
lines changed Original file line number Diff line number Diff line change @@ -13,13 +13,15 @@ struct FilespaceSuggestionSnapshotKey: FilespacePropertyKey {
1313}
1414
1515extension FilespacePropertyValues {
16+ @WorkspaceActor
1617 var suggestionSourceSnapshot : FilespaceSuggestionSnapshot {
1718 get { self [ FilespaceSuggestionSnapshotKey . self] }
1819 set { self [ FilespaceSuggestionSnapshotKey . self] = newValue }
1920 }
2021}
2122
2223extension Filespace {
24+ @WorkspaceActor
2325 func resetSnapshot( ) {
2426 // swiftformat:disable redundantSelf
2527 self . suggestionSourceSnapshot = FilespaceSuggestionSnapshotKey . createDefaultValue ( )
Original file line number Diff line number Diff line change @@ -57,18 +57,6 @@ final class SuggestionServiceWorkspacePlugin: WorkspacePlugin {
5757 return true
5858 }
5959
60- func canAutoTriggerGetSuggestions(
61- forFileAt fileURL: URL ,
62- lines: [ String ] ,
63- cursorPosition: CursorPosition
64- ) -> Bool {
65- guard isRealtimeSuggestionEnabled else { return false }
66- guard let filespace = filespaces [ fileURL] else { return true }
67- if lines. hashValue != filespace. suggestionSourceSnapshot. linesHash { return true }
68- if cursorPosition != filespace. suggestionSourceSnapshot. cursorPosition { return true }
69- return false
70- }
71-
7260 override init ( workspace: Workspace ) {
7361 super. init ( workspace: workspace)
7462
Original file line number Diff line number Diff line change @@ -8,8 +8,9 @@ public protocol FilespacePropertyKey {
88}
99
1010public final class FilespacePropertyValues {
11- var storage : [ ObjectIdentifier : Any ] = [ : ]
11+ private var storage : [ ObjectIdentifier : Any ] = [ : ]
1212
13+ @WorkspaceActor
1314 public subscript< K: FilespacePropertyKey > ( _ key: K . Type ) -> K . Value {
1415 get {
1516 if let value = storage [ ObjectIdentifier ( key) ] as? K . Value {
@@ -65,7 +66,7 @@ public final class Filespace {
6566 }
6667
6768 private( set) var lastSuggestionUpdateTime : Date = Environment . now ( )
68- var additionalProperties = FilespacePropertyValues ( )
69+ private var additionalProperties = FilespacePropertyValues ( )
6970 let fileSaveWatcher : FileSaveWatcher
7071 let onClose : ( URL ) -> Void
7172
@@ -87,6 +88,7 @@ public final class Filespace {
8788 }
8889 }
8990
91+ @WorkspaceActor
9092 public subscript< K> (
9193 dynamicMember dynamicMember: WritableKeyPath < FilespacePropertyValues , K >
9294 ) -> K {
Original file line number Diff line number Diff line change @@ -10,8 +10,9 @@ public protocol WorkspacePropertyKey {
1010}
1111
1212public class WorkspacePropertyValues {
13- var storage : [ ObjectIdentifier : Any ] = [ : ]
13+ private var storage : [ ObjectIdentifier : Any ] = [ : ]
1414
15+ @WorkspaceActor
1516 public subscript< K: WorkspacePropertyKey > ( _ key: K . Type ) -> K . Value {
1617 get {
1718 if let value = storage [ ObjectIdentifier ( key) ] as? K . Value {
@@ -56,7 +57,7 @@ public final class Workspace {
5657 }
5758 }
5859
59- var additionalProperties = WorkspacePropertyValues ( )
60+ private var additionalProperties = WorkspacePropertyValues ( )
6061 public internal( set) var plugins = [ ObjectIdentifier: WorkspacePlugin] ( )
6162 public let workspaceURL : URL
6263 public let projectRootURL : URL
You can’t perform that action at this time.
0 commit comments