mirror of
https://github.com/apple/sourcekit-lsp.git
synced 2026-03-02 18:23:24 +01:00
Call into the BuildSystemManager from SwiftLanguageServer to get build settings
Instead of storing build settings inside the language servers based on update notifications from the build system, always call into the `BuildSystemManager` to get the build settings. Overall, I think this is a much clearer separation of concerns and will allow us to remove `SourceKitServer.documentToPendingQueue` in a follow-up commit as `SwiftLanguageServer` can always directly call into `BuildSystemManager` to get build settings and we don’t need to wait for the initial notification to receive the first build settings. This requies `BuildServerBuildSystem` to keep track of the build settings it has received from the BSP server. `ClangLanguageServer` still caches build settings locally. `ClangLanguageServer` will change to the same pull-based model in a follow-up commit.
This commit is contained in:
@@ -93,6 +93,15 @@ extension CompilationDatabaseBuildSystem: BuildSystem {
|
||||
|
||||
public var indexPrefixMappings: [PathPrefixMapping] { return [] }
|
||||
|
||||
public func buildSettings(for document: DocumentURI, language: Language) async throws -> FileBuildSettings? {
|
||||
// FIXME: (async) Convert this to an async function once `CompilationDatabaseBuildSystem` is an actor.
|
||||
return await withCheckedContinuation { continuation in
|
||||
self.queue.async {
|
||||
continuation.resume(returning: self.settings(for: document))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func registerForChangeNotifications(for uri: DocumentURI, language: Language) {
|
||||
queue.async {
|
||||
self.watchedFiles[uri] = language
|
||||
|
||||
Reference in New Issue
Block a user