mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[SourceKit] Expose ExpectedTypeRelation for the completion results
So that clients can sort the results using this. rdar://problem/59066560
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user