diff --git a/Sources/BuildSystemIntegration/SwiftPMBuildSystem.swift b/Sources/BuildSystemIntegration/SwiftPMBuildSystem.swift index 96d9c3e4c..5eaf798a5 100644 --- a/Sources/BuildSystemIntegration/SwiftPMBuildSystem.swift +++ b/Sources/BuildSystemIntegration/SwiftPMBuildSystem.swift @@ -203,7 +203,7 @@ package actor SwiftPMBuildSystem: BuiltInBuildSystem { throw Error.cannotDetermineHostToolchain } - var absProjectRoot = try AbsolutePath(validating: projectRoot.filePath) + let absProjectRoot = try AbsolutePath(validating: projectRoot.filePath) let hostSDK = try SwiftSDK.hostSwiftSDK(AbsolutePath(validating: destinationToolchainBinDir.filePath)) let hostSwiftPMToolchain = try UserToolchain(swiftSDK: hostSDK) @@ -237,10 +237,10 @@ package actor SwiftPMBuildSystem: BuiltInBuildSystem { fileSystem: localFileSystem ) - if options.backgroundIndexingOrDefault { - location.scratchDirectory = absProjectRoot.appending(components: ".build", "index-build") - } else if let scratchDirectory = options.swiftPMOrDefault.scratchPath { + if let scratchDirectory = options.swiftPMOrDefault.scratchPath { location.scratchDirectory = try AbsolutePath(validating: scratchDirectory, relativeTo: absProjectRoot) + } else if options.backgroundIndexingOrDefault { + location.scratchDirectory = absProjectRoot.appending(components: ".build", "index-build") } var configuration = WorkspaceConfiguration.default diff --git a/Sources/InProcessClient/InProcessSourceKitLSPClient.swift b/Sources/InProcessClient/InProcessSourceKitLSPClient.swift index a4628c3be..6ee01360f 100644 --- a/Sources/InProcessClient/InProcessSourceKitLSPClient.swift +++ b/Sources/InProcessClient/InProcessSourceKitLSPClient.swift @@ -15,7 +15,7 @@ public import Foundation public import LanguageServerProtocol import LanguageServerProtocolExtensions import SKLogging -package import SKOptions +public import SKOptions package import SourceKitLSP import SwiftExtensions import TSCExtensions @@ -31,13 +31,14 @@ public final class InProcessSourceKitLSPClient: Sendable { public convenience init( toolchainPath: URL?, + options: SourceKitLSPOptions = SourceKitLSPOptions(), capabilities: ClientCapabilities = ClientCapabilities(), workspaceFolders: [WorkspaceFolder], messageHandler: any MessageHandler ) async throws { try await self.init( toolchainRegistry: ToolchainRegistry(installPath: toolchainPath), - options: SourceKitLSPOptions(), + options: options, capabilities: capabilities, workspaceFolders: workspaceFolders, messageHandler: messageHandler diff --git a/Sources/SemanticIndex/PreparationTaskDescription.swift b/Sources/SemanticIndex/PreparationTaskDescription.swift index 841c81bf1..b4262d7b7 100644 --- a/Sources/SemanticIndex/PreparationTaskDescription.swift +++ b/Sources/SemanticIndex/PreparationTaskDescription.swift @@ -63,9 +63,10 @@ package struct PreparationTaskDescription: IndexTaskDescription { targetsToPrepare: [BuildTargetIdentifier], buildSystemManager: BuildSystemManager, preparationUpToDateTracker: UpToDateTracker, - logMessageToIndexLog: @escaping @Sendable ( - _ message: String, _ type: WindowMessageType, _ structure: StructuredLogKind - ) -> Void, + logMessageToIndexLog: + @escaping @Sendable ( + _ message: String, _ type: WindowMessageType, _ structure: StructuredLogKind + ) -> Void, hooks: IndexHooks ) { self.targetsToPrepare = targetsToPrepare diff --git a/Sources/SemanticIndex/SemanticIndexManager.swift b/Sources/SemanticIndex/SemanticIndexManager.swift index 9699a480f..67257cd2f 100644 --- a/Sources/SemanticIndex/SemanticIndexManager.swift +++ b/Sources/SemanticIndex/SemanticIndexManager.swift @@ -261,9 +261,10 @@ package final actor SemanticIndexManager { updateIndexStoreTimeout: Duration, hooks: IndexHooks, indexTaskScheduler: TaskScheduler, - logMessageToIndexLog: @escaping @Sendable ( - _ message: String, _ type: WindowMessageType, _ structure: StructuredLogKind - ) -> Void, + logMessageToIndexLog: + @escaping @Sendable ( + _ message: String, _ type: WindowMessageType, _ structure: StructuredLogKind + ) -> Void, indexTasksWereScheduled: @escaping @Sendable (Int) -> Void, indexProgressStatusDidChange: @escaping @Sendable () -> Void ) { diff --git a/Sources/SemanticIndex/UpdateIndexStoreTaskDescription.swift b/Sources/SemanticIndex/UpdateIndexStoreTaskDescription.swift index 319341b71..7bd2362c9 100644 --- a/Sources/SemanticIndex/UpdateIndexStoreTaskDescription.swift +++ b/Sources/SemanticIndex/UpdateIndexStoreTaskDescription.swift @@ -146,9 +146,10 @@ package struct UpdateIndexStoreTaskDescription: IndexTaskDescription { index: UncheckedIndex, indexStoreUpToDateTracker: UpToDateTracker, indexFilesWithUpToDateUnit: Bool, - logMessageToIndexLog: @escaping @Sendable ( - _ message: String, _ type: WindowMessageType, _ structure: StructuredLogKind - ) -> Void, + logMessageToIndexLog: + @escaping @Sendable ( + _ message: String, _ type: WindowMessageType, _ structure: StructuredLogKind + ) -> Void, timeout: Duration, hooks: IndexHooks ) { diff --git a/Sources/SourceKitLSP/SourceKitLSPServer.swift b/Sources/SourceKitLSP/SourceKitLSPServer.swift index e21bffc95..1dd4aee1b 100644 --- a/Sources/SourceKitLSP/SourceKitLSPServer.swift +++ b/Sources/SourceKitLSP/SourceKitLSPServer.swift @@ -390,9 +390,10 @@ package actor SourceKitLSPServer { private func handleRequest( for request: RequestAndReply, - requestHandler: @Sendable @escaping ( - RequestType, Workspace, LanguageService - ) async throws -> + requestHandler: + @Sendable @escaping ( + RequestType, Workspace, LanguageService + ) async throws -> RequestType.Response ) async { await request.reply {