Previously, header files would have their compiler flags inferred
from source files which include them. However, code completion
didn't work properly since the file path in the arguments was
incorrect, pointing to the source file instead of the header file.
This also includes support for source files which include other source files, although that's not a common use case.
Remove `settings(for:)` from the BuildSystem API in favor of the change callback
- With the `settings(for:)` method removed, we instead block on a
callback from the `BuildSystemManager` which itself handles
the primary build system callback in conjunction with the fallback
system
- We queue up notifications / requests that reference documents
until we receive the callback.
- Remove language from FileBuildSettings as it is no longer needed,
Swift-specific working dir fixes are now in SwiftCompileCommand
- registerForChangeNotifications should inform its delegate
asynchronously instead of immediately
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
1) Toolchain ID is no longer unique; XcodeDefault toolchains may be
registered multiple times as long as their path is different
(e.g. different Xcode versions). At the moment no other toolchain
may be duplicated.
2) `BuildSystem` specifies a `Toolchain` directly instead of a
Toolchain identifier.
3) New methods to access Toolchains in the registry:
- All toolchain(s) with the given identifier
- Toolchain (if any) for the given path