mirror of
https://github.com/apple/sourcekit-lsp.git
synced 2026-03-02 18:23:24 +01:00
Introduce a `BuildSystemDelegate` to handle notifications from the build system
* `SourceKitServer` is the main delegate to process these notifications
* Currently limited to changes in `FileBuildSettings`
* Delegate informs the `BuildSystem` of files to watch via `registerChangeWatching(for: URL)` and `unregisterChangeWatching(for: URL)`
* In the future we could have more integration for handling changes in dependencies
Handling changes in `FileBuildSettings`
* `SourceKitServer` sends notifications to the internal LSPs informing them of any opened documents that have changes in their compiler flags
* For clangd, we send a notification to update the compilation database
* For SourceKit/sourcekitd we must close and reopen the file to force a new AST with the new compiler flags
33 lines
1.2 KiB
Swift
33 lines
1.2 KiB
Swift
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See https://swift.org/LICENSE.txt for license information
|
|
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
/// Build settings for a single file.
|
|
///
|
|
/// Encapsulates all the settings needed to compile a single file, including the compiler arguments
|
|
/// and working directory. FileBuildSettings are typically the result of a BuildSystem query.
|
|
public struct FileBuildSettings: Equatable {
|
|
|
|
/// The compiler arguments to use for this file.
|
|
public var compilerArguments: [String]
|
|
|
|
/// The working directory to resolve any relative paths in `compilerArguments`.
|
|
public var workingDirectory: String? = nil
|
|
|
|
public init(
|
|
compilerArguments: [String],
|
|
workingDirectory: String? = nil)
|
|
{
|
|
self.compilerArguments = compilerArguments
|
|
self.workingDirectory = workingDirectory
|
|
}
|
|
}
|