[CodeCompletion] Introduce "Flair" in code completion

To describe fine grained priorities.

Introduce 'CodeCompletionFlair' that is a set of more descriptive flags for
prioritizing completion items. This aims to replace '
SemanticContextKind::ExpressionSpecific' which was a "catch all"
prioritization flag.
This commit is contained in:
Rintaro Ishizaki
2021-05-20 17:14:49 -07:00
parent 509c498a21
commit 6dd5d9482f
36 changed files with 381 additions and 307 deletions

View File

@@ -226,9 +226,10 @@ static bool readCachedModule(llvm::MemoryBuffer *in,
}
CodeCompletionResult *result = nullptr;
CodeCompletionFlair Flair;
if (kind == CodeCompletionResult::Declaration) {
result = new (*V.Sink.Allocator) CodeCompletionResult(
context, /*IsArgumentLabels=*/false, numBytesToErase, string,
context, Flair, /*IsArgumentLabels=*/false, numBytesToErase, string,
declKind, isSystem, moduleName, notRecommended, briefDocComment,
copyArray(*V.Sink.Allocator, ArrayRef<StringRef>(assocUSRs)),
copyArray(*V.Sink.Allocator,
@@ -236,7 +237,7 @@ static bool readCachedModule(llvm::MemoryBuffer *in,
CodeCompletionResult::Unknown, opKind);
} else {
result = new (*V.Sink.Allocator)
CodeCompletionResult(kind, context, /*IsArgumentLabels=*/false,
CodeCompletionResult(kind, context, Flair, /*IsArgumentLabels=*/false,
numBytesToErase, string,
CodeCompletionResult::NotApplicable, opKind);
}