mirror of
https://github.com/apple/sourcekit-lsp.git
synced 2026-03-02 18:23:24 +01:00
Make FallbackBuildSystem not conform to BuildSystem and remove no-op functions from it
This commit is contained in:
@@ -120,7 +120,6 @@ public actor BuildSystemManager {
|
||||
|
||||
public func filesDidChange(_ events: [FileEvent]) async {
|
||||
await self.buildSystem?.filesDidChange(events)
|
||||
self.fallbackBuildSystem?.filesDidChange(events)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,7 +205,6 @@ extension BuildSystemManager {
|
||||
}
|
||||
|
||||
await buildSystem?.registerForChangeNotifications(for: mainFile, language: language)
|
||||
fallbackBuildSystem?.registerForChangeNotifications(for: mainFile, language: language)
|
||||
}
|
||||
|
||||
/// Return settings for `file` based on the `change` settings for `mainFile`.
|
||||
@@ -248,7 +246,7 @@ extension BuildSystemManager {
|
||||
public func fileHandlingCapability(for uri: DocumentURI) async -> FileHandlingCapability {
|
||||
return max(
|
||||
await buildSystem?.fileHandlingCapability(for: uri) ?? .unhandled,
|
||||
fallbackBuildSystem?.fileHandlingCapability(for: uri) ?? .unhandled
|
||||
fallbackBuildSystem != nil ? .fallback : .unhandled
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import class TSCBasic.Process
|
||||
import struct TSCBasic.AbsolutePath
|
||||
|
||||
/// A simple BuildSystem suitable as a fallback when accurate settings are unknown.
|
||||
public final class FallbackBuildSystem: BuildSystem {
|
||||
public final class FallbackBuildSystem {
|
||||
|
||||
let buildSetup: BuildSetup
|
||||
|
||||
@@ -59,13 +59,6 @@ public final class FallbackBuildSystem: BuildSystem {
|
||||
}
|
||||
}
|
||||
|
||||
public func registerForChangeNotifications(for uri: DocumentURI, language: Language) {
|
||||
// Fallback build systems never change.
|
||||
}
|
||||
|
||||
/// We don't support change watching.
|
||||
public func unregisterForChangeNotifications(for: DocumentURI) {}
|
||||
|
||||
func settingsSwift(_ file: String) -> FileBuildSettings {
|
||||
var args: [String] = []
|
||||
args.append(contentsOf: self.buildSetup.flags.swiftCompilerFlags)
|
||||
@@ -98,10 +91,4 @@ public final class FallbackBuildSystem: BuildSystem {
|
||||
args.append(file)
|
||||
return FileBuildSettings(compilerArguments: args)
|
||||
}
|
||||
|
||||
public func filesDidChange(_ events: [FileEvent]) {}
|
||||
|
||||
public func fileHandlingCapability(for uri: DocumentURI) -> FileHandlingCapability {
|
||||
return .fallback
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,8 +34,8 @@ final class BuildSystemManagerTests: XCTestCase {
|
||||
]
|
||||
|
||||
let bsm = await BuildSystemManager(
|
||||
buildSystem: FallbackBuildSystem(buildSetup: .default),
|
||||
fallbackBuildSystem: nil,
|
||||
buildSystem: nil,
|
||||
fallbackBuildSystem: FallbackBuildSystem(buildSetup: .default),
|
||||
mainFilesProvider: mainFiles)
|
||||
defer { withExtendedLifetime(bsm) {} } // Keep BSM alive for callbacks.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user