From 0249741ababb2e363db52143bb9e2d9a32f2198d 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/BuildSystemIntegration/BuildServerBuildSystem.swift | 3 --- Sources/BuildSystemIntegration/BuildSystem.swift | 3 --- .../CompilationDatabaseBuildSystem.swift | 2 -- Sources/BuildSystemIntegration/FallbackBuildSystem.swift | 2 -- Sources/BuildSystemIntegration/SwiftPMBuildSystem.swift | 2 -- Sources/SourceKitLSP/Workspace.swift | 5 +---- .../BuildSystemManagerTests.swift | 1 - Tests/SourceKitLSPTests/BuildSystemTests.swift | 1 - 8 files changed, 1 insertion(+), 18 deletions(-) diff --git a/Sources/BuildSystemIntegration/BuildServerBuildSystem.swift b/Sources/BuildSystemIntegration/BuildServerBuildSystem.swift index e77708465..a6f4563c4 100644 --- a/Sources/BuildSystemIntegration/BuildServerBuildSystem.swift +++ b/Sources/BuildSystemIntegration/BuildServerBuildSystem.swift @@ -72,9 +72,6 @@ package actor BuildServerBuildSystem: MessageHandler { package private(set) var indexDatabasePath: AbsolutePath? package private(set) var indexStorePath: AbsolutePath? - // FIXME: Add support for prefix mappings to the Build Server protocol. - package var indexPrefixMappings: [PathPrefixMapping] { return [] } - /// Delegate to handle any build system events. package weak var delegate: BuildSystemDelegate? diff --git a/Sources/BuildSystemIntegration/BuildSystem.swift b/Sources/BuildSystemIntegration/BuildSystem.swift index 8b9e14c2c..b3bec12d0 100644 --- a/Sources/BuildSystemIntegration/BuildSystem.swift +++ b/Sources/BuildSystemIntegration/BuildSystem.swift @@ -107,9 +107,6 @@ package 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/BuildSystemIntegration/CompilationDatabaseBuildSystem.swift b/Sources/BuildSystemIntegration/CompilationDatabaseBuildSystem.swift index 7ce3239e6..8ce9c8a9e 100644 --- a/Sources/BuildSystemIntegration/CompilationDatabaseBuildSystem.swift +++ b/Sources/BuildSystemIntegration/CompilationDatabaseBuildSystem.swift @@ -100,8 +100,6 @@ extension CompilationDatabaseBuildSystem: BuildSystem { indexStorePath?.parentDirectory.appending(component: "IndexDatabase") } - package var indexPrefixMappings: [PathPrefixMapping] { return [] } - package func buildSettings( for document: DocumentURI, in buildTarget: ConfiguredTarget, diff --git a/Sources/BuildSystemIntegration/FallbackBuildSystem.swift b/Sources/BuildSystemIntegration/FallbackBuildSystem.swift index 61a78e340..b80a3b4c4 100644 --- a/Sources/BuildSystemIntegration/FallbackBuildSystem.swift +++ b/Sources/BuildSystemIntegration/FallbackBuildSystem.swift @@ -49,8 +49,6 @@ package actor FallbackBuildSystem { package var indexDatabasePath: AbsolutePath? { return nil } - package var indexPrefixMappings: [PathPrefixMapping] { return [] } - package func buildSettings(for uri: DocumentURI, language: Language) -> FileBuildSettings? { var fileBuildSettings: FileBuildSettings? switch language { diff --git a/Sources/BuildSystemIntegration/SwiftPMBuildSystem.swift b/Sources/BuildSystemIntegration/SwiftPMBuildSystem.swift index ac4efd482..b58ab8783 100644 --- a/Sources/BuildSystemIntegration/SwiftPMBuildSystem.swift +++ b/Sources/BuildSystemIntegration/SwiftPMBuildSystem.swift @@ -455,8 +455,6 @@ extension SwiftPMBuildSystem: BuildSystemIntegration.BuildSystem { return buildPath.appending(components: "index", "db") } - package 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 e511a7b5a..6a2392189 100644 --- a/Sources/SourceKitLSP/Workspace.swift +++ b/Sources/SourceKitLSP/Workspace.swift @@ -178,10 +178,7 @@ package 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/BuildSystemIntegrationTests/BuildSystemManagerTests.swift b/Tests/BuildSystemIntegrationTests/BuildSystemManagerTests.swift index deb206db6..95e9817dd 100644 --- a/Tests/BuildSystemIntegrationTests/BuildSystemManagerTests.swift +++ b/Tests/BuildSystemIntegrationTests/BuildSystemManagerTests.swift @@ -500,7 +500,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 414757db2..5238d84c7 100644 --- a/Tests/SourceKitLSPTests/BuildSystemTests.swift +++ b/Tests/SourceKitLSPTests/BuildSystemTests.swift @@ -27,7 +27,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?