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
While we generally want to be type-safe, initialization options is
LSP-server specific, so just use LSPAny so we can pass arbitrary data
through as needed.
Clang looks for the C++ standard headers relative to the clang binary
that we provide in the compilation database. So pass through a real path
so that we get the correct headers.
This builds on the indexer changes to support test projects using the
tibs build system. See the commit message from IndexStoreDB for more
information.
This commit adds a couple of simple tests using test fixtures in the
INPUTS directory. It is a fairly minimal change for using the indexer's
test support code to prove the model works. One missing piece here is
support for mutable sources and updating the index, which is supported
on the IndexStoreDB side, but needs a bit more work here. This also
doesn't include any tests using swiftpm's build system.
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
Add remaining foldingRange protocol capabilities
Sending offset data to folding requests
FoldingRange test
Support folding comments
Add test for folded comments
Replaces the Hover request extension that was only provides by Swift
with the new symbolInfo LSP extension that clangd also support. This
enables jump-to-defintion an find-references for C/C++/ObjC by using
clangd to find the symbol and then performing an index query to find the
defintion.
rdar://46436917
Clangd provides a symbolInfo request as an extension to LSP that is
equivalent to sourcekitd's cursor info. For now, just add the new types
and add plumb the request through so we can test it in isolation. In a
future commit this will be used to power jump-to-definition.