mirror of
https://github.com/apple/sourcekit-lsp.git
synced 2026-03-02 18:23:24 +01:00
This way we can log them when a sourcekitd request crashes and we can thus replay these contextual requests when diagnosing the crash.
34 lines
1.1 KiB
Swift
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
|
|
)
|
|
}
|
|
}
|