[SourceKit] Expose ExpectedTypeRelation for the completion results

So that clients can sort the results using this.

rdar://problem/59066560
This commit is contained in:
Rintaro Ishizaki
2020-02-03 15:57:43 -08:00
parent 7934cdf9c3
commit 1e74c39956
16 changed files with 88 additions and 0 deletions

View File

@@ -502,6 +502,22 @@ bool SwiftToSourceKitCompletionAdapter::handleResult(
Info.SemanticContext = CCCtxOtherModule; break;
}
static UIdent CCTypeRelUnrelated("source.codecompletion.typerelation.unrelated");
static UIdent CCTypeRelInvalid("source.codecompletion.typerelation.invalid");
static UIdent CCTypeRelConvertible("source.codecompletion.typerelation.convertible");
static UIdent CCTypeRelIdentical("source.codecompletion.typerelation.identical");
switch (Result->getExpectedTypeRelation()) {
case CodeCompletionResult::Unrelated:
Info.TypeRelation = CCTypeRelUnrelated; break;
case CodeCompletionResult::Invalid:
Info.TypeRelation = CCTypeRelInvalid; break;
case CodeCompletionResult::Convertible:
Info.TypeRelation = CCTypeRelConvertible; break;
case CodeCompletionResult::Identical:
Info.TypeRelation = CCTypeRelIdentical; break;
}
Info.ModuleName = Result->getModuleName();
Info.DocBrief = Result->getBriefDocComment();
Info.NotRecommended = Result->isNotRecommended();