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
While the server supports foldingRange in general, clangd may not
support it, so add a mechanism for capturing the server capabilities and
using them to avoid unsupported requests to clangd (instead, return
nil). This avoids interruptions due to "method not found" errors that
get surfaced very noisily in the IDE.
Add remaining foldingRange protocol capabilities
Sending offset data to folding requests
FoldingRange test
Support folding comments
Add test for folded comments
Factors the cursor_info requests into a single API to asynchronously
make the sourcekitd cursor_info request and wrap the result for easier
consumption from Swift (but not other processing).
Also, cleanup the now unused extensions on Hover that were superceded by
symbolInfo.
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.
This rewrites most of the functions for scanning for toolchains to be
single-purpose and factors the configuration (e.g. specific directories
and environment variable names) to only the highest level API. Clients
can now generally use the shared toolchain registry and ignore all the
scanning logic. Incidentally switches to keeping toolchains in order of
registration to avoid non-determinism.
Rework LineTable. Now that line table is just a collection of `Substring`.
Derive UTF16/UTF8 offset from corresponding view of the content String.
Added several methods to translate between line/UTF(8|16)column and
UTF8 offset.
Resolves: https://bugs.swift.org/browse/SR-9311
We have multiple copies of llvm symbols (indexstoredb, indexstore,
llbuild via swiftpm, and sourcekitd), so it's important to keep them
isolated. In practice this seems to have started breaking after we
updated swiftpm and llbuild was added, but it was already a potential
issue before that. The most egregious issue is if you build sourcekit
with assertions, it enables ABI-breaking checks in llvm. On macOS this
dlopen behaviour is already the default.