mirror of
https://github.com/realm/SwiftLint.git
synced 2026-05-07 20:12:49 +00:00
58928b7e40
This makes syntactically clear which types are rather expensive.
26 lines
935 B
Swift
26 lines
935 B
Swift
import Foundation
|
|
import SourceKittenFramework
|
|
|
|
public extension Request {
|
|
static let disableSourceKit = ProcessInfo.processInfo.environment["SWIFTLINT_DISABLE_SOURCEKIT"] != nil
|
|
|
|
func sendIfNotDisabled() throws -> [String: any SourceKitRepresentable] {
|
|
guard !Self.disableSourceKit else {
|
|
throw Self.Error.connectionInterrupted("SourceKit is disabled by `SWIFTLINT_DISABLE_SOURCEKIT`.")
|
|
}
|
|
return try send()
|
|
}
|
|
|
|
static func cursorInfoWithoutSymbolGraph(file: String, offset: ByteCount, arguments: [String]) -> Request {
|
|
.customRequest(request: [
|
|
"key.request": UID("source.request.cursorinfo"),
|
|
"key.name": file,
|
|
"key.sourcefile": file,
|
|
"key.offset": Int64(offset.value),
|
|
"key.compilerargs": arguments,
|
|
"key.cancel_on_subsequent_request": 0,
|
|
"key.retrieve_symbol_graph": 0
|
|
])
|
|
}
|
|
}
|