Skip to content

Commit a86ed02

Browse files
author
Wang Lun
committed
fixed format issue, path of interface file
1 parent 12135d0 commit a86ed02

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Sources/SwiftLanguageService/OpenInterface.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ extension SwiftLanguageService {
2424
) async throws -> GeneratedInterfaceDetails? {
2525
// Include build settings context to distinguish different versions/configurations
2626
let buildSettingsFileHash = "\(abs(document.buildSettingsFile.stringValue.hashValue))"
27-
let sourcekitdDocumentName = [moduleName, groupName, buildSettingsFileHash].compactMap(\.self).joined(
28-
separator: "."
29-
)
27+
let sourcekitdDocumentName = [moduleName, groupName, buildSettingsFileHash].compactMap(\.self)
28+
.joined(separator: ".")
3029

3130
let urlData = GeneratedInterfaceDocumentURLData(
3231
moduleName: moduleName,
@@ -46,7 +45,13 @@ extension SwiftLanguageService {
4645
if self.capabilityRegistry.clientHasExperimentalCapability(GetReferenceDocumentRequest.method) {
4746
return GeneratedInterfaceDetails(uri: try urlData.uri, position: position)
4847
}
49-
let interfaceFilePath = self.generatedInterfacesPath.appendingPathComponent(urlData.displayName)
48+
let interfaceFilePath = self.generatedInterfacesPath
49+
.appendingPathComponent(buildSettingsFileHash)
50+
.appendingPathComponent(urlData.displayName)
51+
try FileManager.default.createDirectory(
52+
at: interfaceFilePath.deletingLastPathComponent(),
53+
withIntermediateDirectories: true
54+
)
5055
try await generatedInterfaceManager.snapshot(of: urlData).text.write(
5156
to: interfaceFilePath,
5257
atomically: true,

0 commit comments

Comments
 (0)