Skip to content

Commit 3ea9a65

Browse files
include all resources in a build target's sources list
1 parent 3b6ced8 commit 3ea9a65

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

Sources/BuildSystemIntegration/SwiftPMBuildSystem.swift

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,27 @@ package actor SwiftPMBuildSystem: BuiltInBuildSystem {
565565
data: SourceKitSourceItemData(isHeader: true).encodeToLSPAny()
566566
)
567567
}
568+
sources += swiftPMTarget.resources.map {
569+
SourceItem(
570+
uri: DocumentURI($0),
571+
kind: $0.isDirectory ? .directory : .file,
572+
generated: false,
573+
)
574+
}
575+
sources += swiftPMTarget.ignored.map {
576+
SourceItem(
577+
uri: DocumentURI($0),
578+
kind: $0.isDirectory ? .directory : .file,
579+
generated: false,
580+
)
581+
}
582+
sources += swiftPMTarget.others.map {
583+
SourceItem(
584+
uri: DocumentURI($0),
585+
kind: $0.isDirectory ? .directory : .file,
586+
generated: false,
587+
)
588+
}
568589
result.append(SourcesItem(target: target, sources: sources))
569590
}
570591
return BuildTargetSourcesResponse(items: result)
@@ -760,3 +781,9 @@ package actor SwiftPMBuildSystem: BuiltInBuildSystem {
760781
return TextDocumentSourceKitOptionsResponse(compilerArguments: compilerArgs)
761782
}
762783
}
784+
785+
fileprivate extension URL {
786+
var isDirectory: Bool {
787+
(try? resourceValues(forKeys: [.isDirectoryKey]))?.isDirectory == true
788+
}
789+
}

0 commit comments

Comments
 (0)