Files
sourcekit-lsp/Sources/SKTestSupport/SourceKitD+send.swift
Alex Hoppen 69ab356b36 Log contextual requests that affect sourcekitd’s global state
This way we can log them when a sourcekitd request crashes and we can thus replay these contextual requests when diagnosing the crash.
2025-05-12 15:39:52 +02:00

34 lines
1.1 KiB
Swift

//===----------------------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2025 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
package import Csourcekitd
package import SourceKitD
extension SourceKitD {
/// Convenience overload of the `send` function for testing that doesn't restart sourcekitd if it does not respond
/// and doesn't pass any file contents.
package func send(
_ requestUid: KeyPath<sourcekitd_api_requests, sourcekitd_api_uid_t>,
_ request: SKDRequestDictionary,
timeout: Duration = defaultTimeoutDuration
) async throws -> SKDResponseDictionary {
return try await self.send(
requestUid,
request,
timeout: timeout,
restartTimeout: .seconds(60 * 60 * 24),
documentUrl: nil,
fileContents: nil
)
}
}