Allow injection of build systems into SourceKitLSP

This allows us to clean up the creation of `TestBuildSystem` a little bit because the tests can create `TestBuildSystem` instead of retrieving it from the `BuildSystemManager`.

rdar://142906050
This commit is contained in:
Alex Hoppen
2025-01-15 15:57:21 -08:00
parent 403f88e293
commit 31b1909ce1
25 changed files with 192 additions and 165 deletions

View File

@@ -10,30 +10,22 @@
//
//===----------------------------------------------------------------------===//
#if compiler(>=6)
import BuildSystemIntegration
public import Foundation
public import LanguageServerProtocol
import LanguageServerProtocolExtensions
package import SKOptions
import SourceKitLSP
import SwiftExtensions
import ToolchainRegistry
import TSCExtensions
import ToolchainRegistry
import struct TSCBasic.AbsolutePath
#if compiler(>=6)
package import SKOptions
package import SourceKitLSP
#else
import BuildSystemIntegration
import Foundation
import LanguageServerProtocol
import LanguageServerProtocolExtensions
import SKOptions
import SourceKitLSP
import SwiftExtensions
import ToolchainRegistry
import TSCExtensions
import struct TSCBasic.AbsolutePath
#endif
/// Launches a `SourceKitLSPServer` in-process and allows sending messages to it.
@@ -63,6 +55,7 @@ public final class InProcessSourceKitLSPClient: Sendable {
package init(
toolchainPath: URL?,
options: SourceKitLSPOptions = SourceKitLSPOptions(),
hooks: Hooks = Hooks(),
capabilities: ClientCapabilities = ClientCapabilities(),
workspaceFolders: [WorkspaceFolder],
messageHandler: any MessageHandler
@@ -72,7 +65,7 @@ public final class InProcessSourceKitLSPClient: Sendable {
client: serverToClientConnection,
toolchainRegistry: ToolchainRegistry(installPath: toolchainPath),
options: options,
testHooks: TestHooks(),
hooks: hooks,
onExit: {
serverToClientConnection.close()
}