|
|
|
@@ -422,7 +422,7 @@ public:
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// This enum is ordered from the contexts that are "nearest" to the code
|
|
|
|
/// This enum is ordered from the contexts that are "nearest" to the code
|
|
|
|
/// completion point to "outside" contexts.
|
|
|
|
/// completion point to "outside" contexts.
|
|
|
|
enum class SemanticContextKind {
|
|
|
|
enum class SemanticContextKind : uint8_t {
|
|
|
|
/// Used in cases when the concept of semantic context is not applicable.
|
|
|
|
/// Used in cases when the concept of semantic context is not applicable.
|
|
|
|
None,
|
|
|
|
None,
|
|
|
|
|
|
|
|
|
|
|
|
@@ -456,6 +456,8 @@ enum class SemanticContextKind {
|
|
|
|
|
|
|
|
|
|
|
|
/// A declaration imported from other module.
|
|
|
|
/// A declaration imported from other module.
|
|
|
|
OtherModule,
|
|
|
|
OtherModule,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MAX_VALUE = OtherModule
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum class CodeCompletionFlairBit: uint8_t {
|
|
|
|
enum class CodeCompletionFlairBit: uint8_t {
|
|
|
|
@@ -486,7 +488,7 @@ enum class CodeCompletionFlairBit: uint8_t {
|
|
|
|
using CodeCompletionFlair = OptionSet<CodeCompletionFlairBit>;
|
|
|
|
using CodeCompletionFlair = OptionSet<CodeCompletionFlairBit>;
|
|
|
|
|
|
|
|
|
|
|
|
/// The declaration kind of a code completion result, if it is a declaration.
|
|
|
|
/// The declaration kind of a code completion result, if it is a declaration.
|
|
|
|
enum class CodeCompletionDeclKind {
|
|
|
|
enum class CodeCompletionDeclKind : uint8_t {
|
|
|
|
Module,
|
|
|
|
Module,
|
|
|
|
Class,
|
|
|
|
Class,
|
|
|
|
Struct,
|
|
|
|
Struct,
|
|
|
|
@@ -512,7 +514,7 @@ enum class CodeCompletionDeclKind {
|
|
|
|
PrecedenceGroup,
|
|
|
|
PrecedenceGroup,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum class CodeCompletionLiteralKind {
|
|
|
|
enum class CodeCompletionLiteralKind : uint8_t {
|
|
|
|
ArrayLiteral,
|
|
|
|
ArrayLiteral,
|
|
|
|
BooleanLiteral,
|
|
|
|
BooleanLiteral,
|
|
|
|
ColorLiteral,
|
|
|
|
ColorLiteral,
|
|
|
|
@@ -524,7 +526,7 @@ enum class CodeCompletionLiteralKind {
|
|
|
|
Tuple,
|
|
|
|
Tuple,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum class CodeCompletionOperatorKind {
|
|
|
|
enum class CodeCompletionOperatorKind : uint8_t {
|
|
|
|
None,
|
|
|
|
None,
|
|
|
|
Unknown,
|
|
|
|
Unknown,
|
|
|
|
Bang, // !
|
|
|
|
Bang, // !
|
|
|
|
@@ -568,16 +570,18 @@ enum class CodeCompletionOperatorKind {
|
|
|
|
PipeEq, // |=
|
|
|
|
PipeEq, // |=
|
|
|
|
PipePipe, // ||
|
|
|
|
PipePipe, // ||
|
|
|
|
TildeEq, // ~=
|
|
|
|
TildeEq, // ~=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MAX_VALUE = TildeEq
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum class CodeCompletionKeywordKind {
|
|
|
|
enum class CodeCompletionKeywordKind : uint8_t {
|
|
|
|
None,
|
|
|
|
None,
|
|
|
|
#define KEYWORD(X) kw_##X,
|
|
|
|
#define KEYWORD(X) kw_##X,
|
|
|
|
#define POUND_KEYWORD(X) pound_##X,
|
|
|
|
#define POUND_KEYWORD(X) pound_##X,
|
|
|
|
#include "swift/Syntax/TokenKinds.def"
|
|
|
|
#include "swift/Syntax/TokenKinds.def"
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum class CompletionKind {
|
|
|
|
enum class CompletionKind : uint8_t {
|
|
|
|
None,
|
|
|
|
None,
|
|
|
|
Import,
|
|
|
|
Import,
|
|
|
|
UnresolvedMember,
|
|
|
|
UnresolvedMember,
|
|
|
|
@@ -616,12 +620,14 @@ enum class CompletionKind {
|
|
|
|
TypeAttrBeginning,
|
|
|
|
TypeAttrBeginning,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum class CodeCompletionDiagnosticSeverity: uint8_t {
|
|
|
|
enum class CodeCompletionDiagnosticSeverity : uint8_t {
|
|
|
|
None,
|
|
|
|
None,
|
|
|
|
Error,
|
|
|
|
Error,
|
|
|
|
Warning,
|
|
|
|
Warning,
|
|
|
|
Remark,
|
|
|
|
Remark,
|
|
|
|
Note,
|
|
|
|
Note,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MAX_VALUE = Note
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// A single code completion result.
|
|
|
|
/// A single code completion result.
|
|
|
|
@@ -629,17 +635,19 @@ class CodeCompletionResult {
|
|
|
|
friend class CodeCompletionResultBuilder;
|
|
|
|
friend class CodeCompletionResultBuilder;
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
enum class ResultKind {
|
|
|
|
enum class ResultKind : uint8_t {
|
|
|
|
Declaration,
|
|
|
|
Declaration,
|
|
|
|
Keyword,
|
|
|
|
Keyword,
|
|
|
|
Pattern,
|
|
|
|
Pattern,
|
|
|
|
Literal,
|
|
|
|
Literal,
|
|
|
|
BuiltinOperator,
|
|
|
|
BuiltinOperator,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MAX_VALUE = BuiltinOperator
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// Describes the relationship between the type of the completion results and
|
|
|
|
/// Describes the relationship between the type of the completion results and
|
|
|
|
/// the expected type at the code completion position.
|
|
|
|
/// the expected type at the code completion position.
|
|
|
|
enum class ExpectedTypeRelation {
|
|
|
|
enum class ExpectedTypeRelation : uint8_t {
|
|
|
|
/// The result does not have a type (e.g. keyword).
|
|
|
|
/// The result does not have a type (e.g. keyword).
|
|
|
|
NotApplicable,
|
|
|
|
NotApplicable,
|
|
|
|
|
|
|
|
|
|
|
|
@@ -658,9 +666,11 @@ public:
|
|
|
|
|
|
|
|
|
|
|
|
/// The result's type is identical to the type of the expected.
|
|
|
|
/// The result's type is identical to the type of the expected.
|
|
|
|
Identical,
|
|
|
|
Identical,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MAX_VALUE = Identical
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum class NotRecommendedReason {
|
|
|
|
enum class NotRecommendedReason : uint8_t {
|
|
|
|
None = 0,
|
|
|
|
None = 0,
|
|
|
|
RedundantImport,
|
|
|
|
RedundantImport,
|
|
|
|
RedundantImportIndirect,
|
|
|
|
RedundantImportIndirect,
|
|
|
|
@@ -669,16 +679,18 @@ public:
|
|
|
|
InvalidAsyncContext,
|
|
|
|
InvalidAsyncContext,
|
|
|
|
CrossActorReference,
|
|
|
|
CrossActorReference,
|
|
|
|
VariableUsedInOwnDefinition,
|
|
|
|
VariableUsedInOwnDefinition,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MAX_VALUE = VariableUsedInOwnDefinition
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
private:
|
|
|
|
unsigned Kind : 3;
|
|
|
|
ResultKind Kind : 3;
|
|
|
|
unsigned AssociatedKind : 8;
|
|
|
|
unsigned AssociatedKind : 8;
|
|
|
|
unsigned KnownOperatorKind : 6;
|
|
|
|
CodeCompletionOperatorKind KnownOperatorKind : 6;
|
|
|
|
unsigned SemanticContext : 3;
|
|
|
|
SemanticContextKind SemanticContext : 3;
|
|
|
|
unsigned Flair: 8;
|
|
|
|
unsigned char Flair : 8;
|
|
|
|
unsigned NotRecommended : 4;
|
|
|
|
NotRecommendedReason NotRecommended : 4;
|
|
|
|
unsigned IsSystem : 1;
|
|
|
|
bool IsSystem : 1;
|
|
|
|
|
|
|
|
|
|
|
|
/// The number of bytes to the left of the code completion point that
|
|
|
|
/// The number of bytes to the left of the code completion point that
|
|
|
|
/// should be erased first if this completion string is inserted in the
|
|
|
|
/// should be erased first if this completion string is inserted in the
|
|
|
|
@@ -693,10 +705,18 @@ private:
|
|
|
|
StringRef ModuleName;
|
|
|
|
StringRef ModuleName;
|
|
|
|
StringRef BriefDocComment;
|
|
|
|
StringRef BriefDocComment;
|
|
|
|
ArrayRef<StringRef> AssociatedUSRs;
|
|
|
|
ArrayRef<StringRef> AssociatedUSRs;
|
|
|
|
unsigned TypeDistance : 3;
|
|
|
|
ExpectedTypeRelation TypeDistance : 3;
|
|
|
|
unsigned DiagnosticSeverity: 3;
|
|
|
|
CodeCompletionDiagnosticSeverity DiagnosticSeverity : 3;
|
|
|
|
StringRef DiagnosticMessage;
|
|
|
|
StringRef DiagnosticMessage;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Assertions for limiting max values of enums.
|
|
|
|
|
|
|
|
static_assert(int(ResultKind::MAX_VALUE) < 1 << 3, "");
|
|
|
|
|
|
|
|
static_assert(int(CodeCompletionOperatorKind::MAX_VALUE) < 1 << 6, "");
|
|
|
|
|
|
|
|
static_assert(int(SemanticContextKind::MAX_VALUE) < 1 << 3, "");
|
|
|
|
|
|
|
|
static_assert(int(NotRecommendedReason::MAX_VALUE) < 1 << 4, "");
|
|
|
|
|
|
|
|
static_assert(int(ExpectedTypeRelation::MAX_VALUE) < 1 << 3, "");
|
|
|
|
|
|
|
|
static_assert(int(CodeCompletionDiagnosticSeverity::MAX_VALUE) < 1 << 3, "");
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
/// Constructs a \c Pattern, \c Keyword or \c BuiltinOperator result.
|
|
|
|
/// Constructs a \c Pattern, \c Keyword or \c BuiltinOperator result.
|
|
|
|
///
|
|
|
|
///
|
|
|
|
@@ -708,22 +728,20 @@ public:
|
|
|
|
CodeCompletionOperatorKind KnownOperatorKind =
|
|
|
|
CodeCompletionOperatorKind KnownOperatorKind =
|
|
|
|
CodeCompletionOperatorKind::None,
|
|
|
|
CodeCompletionOperatorKind::None,
|
|
|
|
StringRef BriefDocComment = StringRef())
|
|
|
|
StringRef BriefDocComment = StringRef())
|
|
|
|
: Kind(unsigned(Kind)), KnownOperatorKind(unsigned(KnownOperatorKind)),
|
|
|
|
: Kind(Kind), KnownOperatorKind(KnownOperatorKind),
|
|
|
|
SemanticContext(unsigned(SemanticContext)),
|
|
|
|
SemanticContext(SemanticContext), Flair(Flair.toRaw()),
|
|
|
|
Flair(unsigned(Flair.toRaw())),
|
|
|
|
NotRecommended(NotRecommendedReason::None),
|
|
|
|
NotRecommended(unsigned(NotRecommendedReason::None)),
|
|
|
|
|
|
|
|
NumBytesToErase(NumBytesToErase), CompletionString(CompletionString),
|
|
|
|
NumBytesToErase(NumBytesToErase), CompletionString(CompletionString),
|
|
|
|
BriefDocComment(BriefDocComment), TypeDistance(unsigned(TypeDistance)) {
|
|
|
|
BriefDocComment(BriefDocComment), TypeDistance(TypeDistance) {
|
|
|
|
assert(Kind != ResultKind::Declaration && "use the other constructor");
|
|
|
|
assert(Kind != ResultKind::Declaration && "use the other constructor");
|
|
|
|
assert(CompletionString);
|
|
|
|
assert(CompletionString);
|
|
|
|
if (isOperator() && KnownOperatorKind == CodeCompletionOperatorKind::None)
|
|
|
|
if (isOperator() && KnownOperatorKind == CodeCompletionOperatorKind::None)
|
|
|
|
this->KnownOperatorKind =
|
|
|
|
this->KnownOperatorKind = getCodeCompletionOperatorKind(CompletionString);
|
|
|
|
(unsigned)getCodeCompletionOperatorKind(CompletionString);
|
|
|
|
|
|
|
|
assert(!isOperator() ||
|
|
|
|
assert(!isOperator() ||
|
|
|
|
getOperatorKind() != CodeCompletionOperatorKind::None);
|
|
|
|
getOperatorKind() != CodeCompletionOperatorKind::None);
|
|
|
|
AssociatedKind = 0;
|
|
|
|
AssociatedKind = 0;
|
|
|
|
IsSystem = 0;
|
|
|
|
IsSystem = false;
|
|
|
|
DiagnosticSeverity = 0;
|
|
|
|
DiagnosticSeverity = CodeCompletionDiagnosticSeverity::None;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Constructs a \c Keyword result.
|
|
|
|
/// Constructs a \c Keyword result.
|
|
|
|
@@ -735,16 +753,16 @@ public:
|
|
|
|
CodeCompletionString *CompletionString,
|
|
|
|
CodeCompletionString *CompletionString,
|
|
|
|
ExpectedTypeRelation TypeDistance,
|
|
|
|
ExpectedTypeRelation TypeDistance,
|
|
|
|
StringRef BriefDocComment = StringRef())
|
|
|
|
StringRef BriefDocComment = StringRef())
|
|
|
|
: Kind(unsigned(ResultKind::Keyword)), KnownOperatorKind(0),
|
|
|
|
: Kind(ResultKind::Keyword),
|
|
|
|
SemanticContext(unsigned(SemanticContext)),
|
|
|
|
KnownOperatorKind(CodeCompletionOperatorKind::None),
|
|
|
|
Flair(unsigned(Flair.toRaw())),
|
|
|
|
SemanticContext(SemanticContext), Flair(Flair.toRaw()),
|
|
|
|
NotRecommended(unsigned(NotRecommendedReason::None)),
|
|
|
|
NotRecommended(NotRecommendedReason::None),
|
|
|
|
NumBytesToErase(NumBytesToErase), CompletionString(CompletionString),
|
|
|
|
NumBytesToErase(NumBytesToErase), CompletionString(CompletionString),
|
|
|
|
BriefDocComment(BriefDocComment), TypeDistance(unsigned(TypeDistance)) {
|
|
|
|
BriefDocComment(BriefDocComment), TypeDistance(TypeDistance) {
|
|
|
|
assert(CompletionString);
|
|
|
|
assert(CompletionString);
|
|
|
|
AssociatedKind = static_cast<unsigned>(Kind);
|
|
|
|
AssociatedKind = static_cast<unsigned>(Kind);
|
|
|
|
IsSystem = 0;
|
|
|
|
IsSystem = false;
|
|
|
|
DiagnosticSeverity = 0;
|
|
|
|
DiagnosticSeverity = CodeCompletionDiagnosticSeverity::None;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Constructs a \c Literal result.
|
|
|
|
/// Constructs a \c Literal result.
|
|
|
|
@@ -755,15 +773,15 @@ public:
|
|
|
|
CodeCompletionFlair Flair, unsigned NumBytesToErase,
|
|
|
|
CodeCompletionFlair Flair, unsigned NumBytesToErase,
|
|
|
|
CodeCompletionString *CompletionString,
|
|
|
|
CodeCompletionString *CompletionString,
|
|
|
|
ExpectedTypeRelation TypeDistance)
|
|
|
|
ExpectedTypeRelation TypeDistance)
|
|
|
|
: Kind(unsigned(ResultKind::Literal)), KnownOperatorKind(0),
|
|
|
|
: Kind(ResultKind::Literal),
|
|
|
|
SemanticContext(unsigned(SemanticContext)),
|
|
|
|
KnownOperatorKind(CodeCompletionOperatorKind::None),
|
|
|
|
Flair(unsigned(Flair.toRaw())),
|
|
|
|
SemanticContext(SemanticContext), Flair(Flair.toRaw()),
|
|
|
|
NotRecommended(unsigned(NotRecommendedReason::None)),
|
|
|
|
NotRecommended(NotRecommendedReason::None),
|
|
|
|
NumBytesToErase(NumBytesToErase), CompletionString(CompletionString),
|
|
|
|
NumBytesToErase(NumBytesToErase), CompletionString(CompletionString),
|
|
|
|
TypeDistance(unsigned(TypeDistance)) {
|
|
|
|
TypeDistance(TypeDistance) {
|
|
|
|
AssociatedKind = static_cast<unsigned>(LiteralKind);
|
|
|
|
AssociatedKind = static_cast<unsigned>(LiteralKind);
|
|
|
|
IsSystem = 0;
|
|
|
|
IsSystem = false;
|
|
|
|
DiagnosticSeverity = 0;
|
|
|
|
DiagnosticSeverity = CodeCompletionDiagnosticSeverity::None;
|
|
|
|
assert(CompletionString);
|
|
|
|
assert(CompletionString);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -780,20 +798,20 @@ public:
|
|
|
|
StringRef BriefDocComment,
|
|
|
|
StringRef BriefDocComment,
|
|
|
|
ArrayRef<StringRef> AssociatedUSRs,
|
|
|
|
ArrayRef<StringRef> AssociatedUSRs,
|
|
|
|
ExpectedTypeRelation TypeDistance)
|
|
|
|
ExpectedTypeRelation TypeDistance)
|
|
|
|
: Kind(unsigned(ResultKind::Declaration)), KnownOperatorKind(0),
|
|
|
|
: Kind(ResultKind::Declaration),
|
|
|
|
SemanticContext(unsigned(SemanticContext)),
|
|
|
|
KnownOperatorKind(CodeCompletionOperatorKind::None),
|
|
|
|
Flair(unsigned(Flair.toRaw())), NotRecommended(unsigned(NotRecReason)),
|
|
|
|
SemanticContext(SemanticContext), Flair(Flair.toRaw()),
|
|
|
|
NumBytesToErase(NumBytesToErase), CompletionString(CompletionString),
|
|
|
|
NotRecommended(NotRecReason), NumBytesToErase(NumBytesToErase),
|
|
|
|
ModuleName(ModuleName), BriefDocComment(BriefDocComment),
|
|
|
|
CompletionString(CompletionString), ModuleName(ModuleName),
|
|
|
|
AssociatedUSRs(AssociatedUSRs), TypeDistance(unsigned(TypeDistance)) {
|
|
|
|
BriefDocComment(BriefDocComment), AssociatedUSRs(AssociatedUSRs),
|
|
|
|
|
|
|
|
TypeDistance(TypeDistance) {
|
|
|
|
assert(AssociatedDecl && "should have a decl");
|
|
|
|
assert(AssociatedDecl && "should have a decl");
|
|
|
|
AssociatedKind = unsigned(getCodeCompletionDeclKind(AssociatedDecl));
|
|
|
|
AssociatedKind = unsigned(getCodeCompletionDeclKind(AssociatedDecl));
|
|
|
|
IsSystem = getDeclIsSystem(AssociatedDecl);
|
|
|
|
IsSystem = getDeclIsSystem(AssociatedDecl);
|
|
|
|
DiagnosticSeverity = 0;
|
|
|
|
DiagnosticSeverity = CodeCompletionDiagnosticSeverity::None;
|
|
|
|
assert(CompletionString);
|
|
|
|
assert(CompletionString);
|
|
|
|
if (isOperator())
|
|
|
|
if (isOperator())
|
|
|
|
KnownOperatorKind =
|
|
|
|
KnownOperatorKind = getCodeCompletionOperatorKind(CompletionString);
|
|
|
|
(unsigned)getCodeCompletionOperatorKind(CompletionString);
|
|
|
|
|
|
|
|
assert(!isOperator() ||
|
|
|
|
assert(!isOperator() ||
|
|
|
|
getOperatorKind() != CodeCompletionOperatorKind::None);
|
|
|
|
getOperatorKind() != CodeCompletionOperatorKind::None);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -810,16 +828,13 @@ public:
|
|
|
|
ArrayRef<StringRef> AssociatedUSRs,
|
|
|
|
ArrayRef<StringRef> AssociatedUSRs,
|
|
|
|
ExpectedTypeRelation TypeDistance,
|
|
|
|
ExpectedTypeRelation TypeDistance,
|
|
|
|
CodeCompletionOperatorKind KnownOperatorKind)
|
|
|
|
CodeCompletionOperatorKind KnownOperatorKind)
|
|
|
|
: Kind(unsigned(ResultKind::Declaration)),
|
|
|
|
: Kind(ResultKind::Declaration), KnownOperatorKind(KnownOperatorKind),
|
|
|
|
KnownOperatorKind(unsigned(KnownOperatorKind)),
|
|
|
|
SemanticContext(SemanticContext), Flair(Flair.toRaw()),
|
|
|
|
SemanticContext(unsigned(SemanticContext)),
|
|
|
|
NotRecommended(NotRecReason), IsSystem(IsSystem),
|
|
|
|
Flair(unsigned(Flair.toRaw())), NotRecommended(unsigned(NotRecReason)),
|
|
|
|
NumBytesToErase(NumBytesToErase), CompletionString(CompletionString),
|
|
|
|
IsSystem(IsSystem), NumBytesToErase(NumBytesToErase),
|
|
|
|
ModuleName(ModuleName), BriefDocComment(BriefDocComment),
|
|
|
|
CompletionString(CompletionString), ModuleName(ModuleName),
|
|
|
|
AssociatedUSRs(AssociatedUSRs), TypeDistance(TypeDistance),
|
|
|
|
BriefDocComment(BriefDocComment), AssociatedUSRs(AssociatedUSRs),
|
|
|
|
DiagnosticSeverity(diagSeverity), DiagnosticMessage(DiagnosticMessage) {
|
|
|
|
TypeDistance(unsigned(TypeDistance)),
|
|
|
|
|
|
|
|
DiagnosticSeverity(unsigned(diagSeverity)),
|
|
|
|
|
|
|
|
DiagnosticMessage(DiagnosticMessage) {
|
|
|
|
|
|
|
|
AssociatedKind = static_cast<unsigned>(DeclKind);
|
|
|
|
AssociatedKind = static_cast<unsigned>(DeclKind);
|
|
|
|
assert(CompletionString);
|
|
|
|
assert(CompletionString);
|
|
|
|
assert(!isOperator() ||
|
|
|
|
assert(!isOperator() ||
|
|
|
|
@@ -832,7 +847,7 @@ public:
|
|
|
|
CodeCompletionResult *withFlair(CodeCompletionFlair newFlair,
|
|
|
|
CodeCompletionResult *withFlair(CodeCompletionFlair newFlair,
|
|
|
|
CodeCompletionResultSink &Sink);
|
|
|
|
CodeCompletionResultSink &Sink);
|
|
|
|
|
|
|
|
|
|
|
|
ResultKind getKind() const { return static_cast<ResultKind>(Kind); }
|
|
|
|
ResultKind getKind() const { return Kind; }
|
|
|
|
|
|
|
|
|
|
|
|
CodeCompletionDeclKind getAssociatedDeclKind() const {
|
|
|
|
CodeCompletionDeclKind getAssociatedDeclKind() const {
|
|
|
|
assert(getKind() == ResultKind::Declaration);
|
|
|
|
assert(getKind() == ResultKind::Declaration);
|
|
|
|
@@ -864,33 +879,23 @@ public:
|
|
|
|
|
|
|
|
|
|
|
|
CodeCompletionOperatorKind getOperatorKind() const {
|
|
|
|
CodeCompletionOperatorKind getOperatorKind() const {
|
|
|
|
assert(isOperator());
|
|
|
|
assert(isOperator());
|
|
|
|
return static_cast<CodeCompletionOperatorKind>(KnownOperatorKind);
|
|
|
|
return KnownOperatorKind;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool isSystem() const {
|
|
|
|
bool isSystem() const { return IsSystem; }
|
|
|
|
return static_cast<bool>(IsSystem);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ExpectedTypeRelation getExpectedTypeRelation() const {
|
|
|
|
ExpectedTypeRelation getExpectedTypeRelation() const { return TypeDistance; }
|
|
|
|
return static_cast<ExpectedTypeRelation>(TypeDistance);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NotRecommendedReason getNotRecommendedReason() const {
|
|
|
|
NotRecommendedReason getNotRecommendedReason() const {
|
|
|
|
return static_cast<NotRecommendedReason>(NotRecommended);
|
|
|
|
return NotRecommended;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SemanticContextKind getSemanticContext() const {
|
|
|
|
SemanticContextKind getSemanticContext() const { return SemanticContext; }
|
|
|
|
return static_cast<SemanticContextKind>(SemanticContext);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CodeCompletionFlair getFlair() const {
|
|
|
|
CodeCompletionFlair getFlair() const { return CodeCompletionFlair(Flair); }
|
|
|
|
return static_cast<CodeCompletionFlair>(Flair);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Modify "flair" of this result *in place*.
|
|
|
|
/// Modify "flair" of this result *in place*.
|
|
|
|
void setFlair(CodeCompletionFlair flair) {
|
|
|
|
void setFlair(CodeCompletionFlair flair) { Flair = flair.toRaw(); }
|
|
|
|
Flair = unsigned(flair.toRaw());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool isNotRecommended() const {
|
|
|
|
bool isNotRecommended() const {
|
|
|
|
return getNotRecommendedReason() != NotRecommendedReason::None;
|
|
|
|
return getNotRecommendedReason() != NotRecommendedReason::None;
|
|
|
|
@@ -915,12 +920,12 @@ public:
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void setDiagnostics(CodeCompletionDiagnosticSeverity severity, StringRef message) {
|
|
|
|
void setDiagnostics(CodeCompletionDiagnosticSeverity severity, StringRef message) {
|
|
|
|
DiagnosticSeverity = static_cast<unsigned>(severity);
|
|
|
|
DiagnosticSeverity = severity;
|
|
|
|
DiagnosticMessage = message;
|
|
|
|
DiagnosticMessage = message;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CodeCompletionDiagnosticSeverity getDiagnosticSeverity() const {
|
|
|
|
CodeCompletionDiagnosticSeverity getDiagnosticSeverity() const {
|
|
|
|
return static_cast<CodeCompletionDiagnosticSeverity>(DiagnosticSeverity);
|
|
|
|
return DiagnosticSeverity;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
StringRef getDiagnosticMessage() const {
|
|
|
|
StringRef getDiagnosticMessage() const {
|
|
|
|
|