@@ -392,6 +392,20 @@ package actor BuildSystemManager: QueueBasedMessageHandler {
392
392
/// `pathComponents` is the result of `key.fileURL?.pathComponents`. We frequently need these path components to
393
393
/// determine if a file is descendent of the directory and computing them from the `DocumentURI` is expensive.
394
394
let directories : [ DocumentURI : ( pathComponents: [ String ] ? , info: SourceFileInfo ) ]
395
+
396
+ /// Same as `Set(files.filter(\.value.isBuildable).keys)`. Pre-computed because we need thi pretty frequently in
397
+ /// `SemanticIndexManager.filesToIndex`.
398
+ let buildableSourceFiles : Set < DocumentURI >
399
+
400
+ internal init (
401
+ files: [ DocumentURI : SourceFileInfo ] ,
402
+ directories: [ DocumentURI : ( pathComponents: [ String ] ? , info: SourceFileInfo ) ]
403
+ ) {
404
+ self . files = files
405
+ self . directories = directories
406
+ self . buildableSourceFiles = Set ( files. filter ( \. value. isBuildable) . keys)
407
+ }
408
+
395
409
}
396
410
397
411
private let cachedSourceFilesAndDirectories = Cache < SourceFilesAndDirectoriesKey , SourceFilesAndDirectories > ( )
@@ -1153,6 +1167,13 @@ package actor BuildSystemManager: QueueBasedMessageHandler {
1153
1167
}
1154
1168
}
1155
1169
1170
+ /// Returns all source files in the project that are considered buildable.
1171
+ ///
1172
+ /// - SeeAlso: Comment in `sourceFilesAndDirectories` for a definition of what `buildable` means.
1173
+ package func buildableSourceFiles( ) async throws -> Set < DocumentURI > {
1174
+ return try await sourceFilesAndDirectories ( ) . buildableSourceFiles
1175
+ }
1176
+
1156
1177
/// Get all files and directories that are known to the build system, ie. that are returned by a `buildTarget/sources`
1157
1178
/// request for any target in the project.
1158
1179
///
0 commit comments