[SourceKit] Add a global-configuration request to control SourceKit's behavior around .swiftsourceinfo files

SwiftSourceInfo files provide source location information for decls coming from
loaded modules. For most IDE use cases it either has an undesirable impact on
performance with no benefit (code completion), results in stale locations being
used instead of more up-to-date indexer locations (cursor info), or has no
observable effect (live diagnostics, which are filtered to just those with a
location in the primary file).

For non-IDE clients of SourceKit though, cursor info providing declaration
locations for symbols from other modules is useful, so add a global
configuration option (and a new request to set it) to control whether
.swiftsourceinfo files are loaded or not based on use case (they are loaded by
default).
This commit is contained in:
Nathan Hawes
2019-11-19 17:48:19 -08:00
parent 12bda79e23
commit b9d5672ca1
23 changed files with 226 additions and 55 deletions

View File

@@ -263,8 +263,9 @@ SwiftLangSupport::SwiftLangSupport(SourceKit::Context &SKCtx)
Stats = std::make_shared<SwiftStatistics>();
EditorDocuments = std::make_shared<SwiftEditorDocumentFileMap>();
ASTMgr = std::make_shared<SwiftASTManager>(EditorDocuments, Stats,
RuntimeResourcePath);
ASTMgr = std::make_shared<SwiftASTManager>(EditorDocuments,
SKCtx.getGlobalConfiguration(),
Stats, RuntimeResourcePath);
// By default, just use the in-memory cache.
CCCache->inMemory = llvm::make_unique<ide::CodeCompletionCache>();