Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,12 @@ public struct DocumentURI: Codable, Hashable, Sendable {
/// fallback mode that drops semantic functionality.
public var pseudoPath: String {
if storage.isFileURL {
return storage.withUnsafeFileSystemRepresentation {
String(cString: $0!)
return storage.withUnsafeFileSystemRepresentation { filePath in
if let filePath {
String(cString: filePath)
} else {
""
}
}
} else {
return storage.absoluteString
Expand Down
5 changes: 5 additions & 0 deletions Tests/SourceKitLSPTests/LifecycleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,9 @@ final class LifecycleTests: XCTestCase {
)
)
}

func testOpenFileWithoutPath() async throws {
let testClient = try await TestSourceKitLSPClient()
testClient.openDocument("", uri: DocumentURI(try XCTUnwrap(URL(string: "file://"))), language: .swift)
}
}