mirror of
https://github.com/apple/sourcekit-lsp.git
synced 2026-03-02 18:23:24 +01:00
Introduce a notion of ConfiguredTargets into the build system
Instead of asking for build settings of a file, the build system manager asks for the targets of a file and then asks for the build settings of that file in a specific target. This has two advantages: - We know about targets and can prepare the targets for background indexing - Once we support build systems in which a single file can be part of multiple targets, we can have a centralized place that picks preferred targets for a file, eg. based on user configuration
This commit is contained in:
@@ -93,14 +93,17 @@ public actor CompilationDatabaseBuildSystem {
|
||||
}
|
||||
|
||||
extension CompilationDatabaseBuildSystem: BuildSystem {
|
||||
|
||||
public var indexDatabasePath: AbsolutePath? {
|
||||
indexStorePath?.parentDirectory.appending(component: "IndexDatabase")
|
||||
}
|
||||
|
||||
public var indexPrefixMappings: [PathPrefixMapping] { return [] }
|
||||
|
||||
public func buildSettings(for document: DocumentURI, language: Language) async -> FileBuildSettings? {
|
||||
public func buildSettings(
|
||||
for document: DocumentURI,
|
||||
in buildTarget: ConfiguredTarget,
|
||||
language: Language
|
||||
) async -> FileBuildSettings? {
|
||||
guard let url = document.fileURL else {
|
||||
// We can't determine build settings for non-file URIs.
|
||||
return nil
|
||||
@@ -118,6 +121,10 @@ extension CompilationDatabaseBuildSystem: BuildSystem {
|
||||
return nil
|
||||
}
|
||||
|
||||
public func configuredTargets(for document: DocumentURI) async -> [ConfiguredTarget] {
|
||||
return [ConfiguredTarget(targetID: "dummy", runDestinationID: "dummy")]
|
||||
}
|
||||
|
||||
public func registerForChangeNotifications(for uri: DocumentURI) async {
|
||||
self.watchedFiles.insert(uri)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user