[SourceKit] Don't use diagnostics to indicate fast-completion

Add 'key.reusingastcontext: 1' to the response instead.
Using diagnostics can be a noise to indexing log clients.

rdar://problem/61367416
This commit is contained in:
Rintaro Ishizaki
2020-04-07 16:26:00 -07:00
parent 31e7873704
commit 4870d1c017
22 changed files with 148 additions and 162 deletions

View File

@@ -129,11 +129,12 @@ static bool swiftCodeCompleteImpl(
bool EnableASTCaching, bool annotateDescription, std::string &Error) {
return Lang.performCompletionLikeOperation(
UnresolvedInputFile, Offset, Args, FileSystem, EnableASTCaching, Error,
[&](CompilerInstance &CI) {
[&](CompilerInstance &CI, bool reusingASTContext) {
// Create a factory for code completion callbacks that will feed the
// Consumer.
auto swiftCache = Lang.getCodeCompletionCache(); // Pin the cache.
ide::CodeCompletionContext CompletionContext(swiftCache->getCache());
CompletionContext.ReusingASTContext = reusingASTContext;
CompletionContext.setAnnotateResult(annotateDescription);
std::unique_ptr<CodeCompletionCallbacksFactory> callbacksFactory(
ide::makeCodeCompletionCallbacksFactory(CompletionContext,
@@ -211,6 +212,8 @@ void SwiftLangSupport::codeComplete(
SKConsumer, Result, CCOpts.annotatedDescription))
break;
}
SKConsumer.setReusingASTContext(info.completionContext->ReusingASTContext);
});
std::string Error;