From 43a75e5d0bb948512bc92ecc34e36c6e33b6551b Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Wed, 17 Jul 2024 15:19:50 -0700 Subject: [PATCH] Remove `indexPrefixMappings` from `BuildSystem` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit They weren’t used. --- Sources/SKCore/BuildServerBuildSystem.swift | 3 --- Sources/SKCore/BuildSystem.swift | 3 --- Sources/SKCore/CompilationDatabaseBuildSystem.swift | 2 -- Sources/SKCore/FallbackBuildSystem.swift | 2 -- Sources/SKSwiftPMWorkspace/SwiftPMBuildSystem.swift | 2 -- Sources/SourceKitLSP/Workspace.swift | 5 +---- Tests/SKCoreTests/BuildSystemManagerTests.swift | 1 - Tests/SourceKitLSPTests/BuildSystemTests.swift | 1 - 8 files changed, 1 insertion(+), 18 deletions(-) diff --git a/Sources/SKCore/BuildServerBuildSystem.swift b/Sources/SKCore/BuildServerBuildSystem.swift index d46c95050..d73bc0d72 100644 --- a/Sources/SKCore/BuildServerBuildSystem.swift +++ b/Sources/SKCore/BuildServerBuildSystem.swift @@ -65,9 +65,6 @@ public actor BuildServerBuildSystem: MessageHandler { public private(set) var indexDatabasePath: AbsolutePath? public private(set) var indexStorePath: AbsolutePath? - // FIXME: Add support for prefix mappings to the Build Server protocol. - public var indexPrefixMappings: [PathPrefixMapping] { return [] } - /// Delegate to handle any build system events. public weak var delegate: BuildSystemDelegate? diff --git a/Sources/SKCore/BuildSystem.swift b/Sources/SKCore/BuildSystem.swift index 7ea32e4c0..6420a3bf4 100644 --- a/Sources/SKCore/BuildSystem.swift +++ b/Sources/SKCore/BuildSystem.swift @@ -106,9 +106,6 @@ public protocol BuildSystem: AnyObject, Sendable { /// The path to put the index database, if any. var indexDatabasePath: AbsolutePath? { get async } - /// Path remappings for remapping index data for local use. - var indexPrefixMappings: [PathPrefixMapping] { get async } - /// Delegate to handle any build system events such as file build settings initial reports as well as changes. /// /// The build system must not retain the delegate because the delegate can be the `BuildSystemManager`, which could diff --git a/Sources/SKCore/CompilationDatabaseBuildSystem.swift b/Sources/SKCore/CompilationDatabaseBuildSystem.swift index 445ae8493..5122fb1de 100644 --- a/Sources/SKCore/CompilationDatabaseBuildSystem.swift +++ b/Sources/SKCore/CompilationDatabaseBuildSystem.swift @@ -99,8 +99,6 @@ extension CompilationDatabaseBuildSystem: BuildSystem { indexStorePath?.parentDirectory.appending(component: "IndexDatabase") } - public var indexPrefixMappings: [PathPrefixMapping] { return [] } - public func buildSettings( for document: DocumentURI, in buildTarget: ConfiguredTarget, diff --git a/Sources/SKCore/FallbackBuildSystem.swift b/Sources/SKCore/FallbackBuildSystem.swift index 084b011bb..cc71a869b 100644 --- a/Sources/SKCore/FallbackBuildSystem.swift +++ b/Sources/SKCore/FallbackBuildSystem.swift @@ -52,8 +52,6 @@ public actor FallbackBuildSystem { public var indexDatabasePath: AbsolutePath? { return nil } - public var indexPrefixMappings: [PathPrefixMapping] { return [] } - public func buildSettings(for uri: DocumentURI, language: Language) -> FileBuildSettings? { var fileBuildSettings: FileBuildSettings? switch language { diff --git a/Sources/SKSwiftPMWorkspace/SwiftPMBuildSystem.swift b/Sources/SKSwiftPMWorkspace/SwiftPMBuildSystem.swift index c0a317a16..86c7e399f 100644 --- a/Sources/SKSwiftPMWorkspace/SwiftPMBuildSystem.swift +++ b/Sources/SKSwiftPMWorkspace/SwiftPMBuildSystem.swift @@ -454,8 +454,6 @@ extension SwiftPMBuildSystem: SKCore.BuildSystem { return buildPath.appending(components: "index", "db") } - public var indexPrefixMappings: [PathPrefixMapping] { return [] } - /// Return the compiler arguments for the given source file within a target, making any necessary adjustments to /// account for differences in the SwiftPM versions being linked into SwiftPM and being installed in the toolchain. private func compilerArguments(for file: DocumentURI, in buildTarget: any SwiftBuildTarget) async throws -> [String] { diff --git a/Sources/SourceKitLSP/Workspace.swift b/Sources/SourceKitLSP/Workspace.swift index 26a847c1c..ad0405712 100644 --- a/Sources/SourceKitLSP/Workspace.swift +++ b/Sources/SourceKitLSP/Workspace.swift @@ -176,10 +176,7 @@ public final class Workspace: Sendable { let lib = try IndexStoreLibrary(dylibPath: libPath.pathString) indexDelegate = SourceKitIndexDelegate() let prefixMappings = - await firstNonNil( - indexOptions.indexPrefixMap?.map { PathPrefixMapping(original: $0.key, replacement: $0.value) }, - await buildSystem?.indexPrefixMappings - ) ?? [] + indexOptions.indexPrefixMap?.map { PathPrefixMapping(original: $0.key, replacement: $0.value) } ?? [] index = try IndexStoreDB( storePath: storePath.pathString, databasePath: dbPath.pathString, diff --git a/Tests/SKCoreTests/BuildSystemManagerTests.swift b/Tests/SKCoreTests/BuildSystemManagerTests.swift index abaeaabb2..f457dea22 100644 --- a/Tests/SKCoreTests/BuildSystemManagerTests.swift +++ b/Tests/SKCoreTests/BuildSystemManagerTests.swift @@ -498,7 +498,6 @@ class ManualBuildSystem: BuildSystem { var indexStorePath: AbsolutePath? { nil } var indexDatabasePath: AbsolutePath? { nil } - var indexPrefixMappings: [PathPrefixMapping] { return [] } func filesDidChange(_ events: [FileEvent]) {} diff --git a/Tests/SourceKitLSPTests/BuildSystemTests.swift b/Tests/SourceKitLSPTests/BuildSystemTests.swift index 6611d1c7f..a2a83cd74 100644 --- a/Tests/SourceKitLSPTests/BuildSystemTests.swift +++ b/Tests/SourceKitLSPTests/BuildSystemTests.swift @@ -26,7 +26,6 @@ actor TestBuildSystem: BuildSystem { let projectRoot: AbsolutePath = try! AbsolutePath(validating: "/") let indexStorePath: AbsolutePath? = nil let indexDatabasePath: AbsolutePath? = nil - let indexPrefixMappings: [PathPrefixMapping] = [] weak var delegate: BuildSystemDelegate?