SourceKit: Refactor Kinds UIDs to ProtocolUIDs.def. (#10604)

"Kind" is a frequently appearing concept in SourceKitD. This patch
refactors the definitions of these "Kinds" and their associated values
 into the single protocol file. Ideally, we should structurally define Kinds instead of this
flat list.
This commit is contained in:
Xi Ge
2017-06-27 10:51:48 -07:00
committed by GitHub
parent 43ecc9de48
commit 63aeb0123e
4 changed files with 165 additions and 189 deletions

View File

@@ -6,6 +6,10 @@
#define REQUEST(NAME, CONTENT)
#endif
#ifndef KIND
#define KIND(NAME, CONTENT)
#endif
KEY(VersionMajor, "key.version_major")
KEY(VersionMinor, "key.version_minor")
KEY(Results, "key.results")
@@ -154,5 +158,137 @@ REQUEST(ModuleGroups, "source.request.module.groups")
REQUEST(NameTranslation, "source.request.name.translation")
REQUEST(MarkupToXML, "source.request.convert.markup.xml")
KIND(DeclFunctionFree, "source.lang.swift.decl.function.free")
KIND(RefFunctionFree, "source.lang.swift.ref.function.free")
KIND(DeclMethodInstance, "source.lang.swift.decl.function.method.instance")
KIND(RefMethodInstance, "source.lang.swift.ref.function.method.instance")
KIND(DeclMethodStatic, "source.lang.swift.decl.function.method.static")
KIND(RefMethodStatic, "source.lang.swift.ref.function.method.static")
KIND(DeclMethodClass, "source.lang.swift.decl.function.method.class")
KIND(RefMethodClass, "source.lang.swift.ref.function.method.class")
KIND(DeclAccessorGetter, "source.lang.swift.decl.function.accessor.getter")
KIND(RefAccessorGetter, "source.lang.swift.ref.function.accessor.getter")
KIND(DeclAccessorSetter, "source.lang.swift.decl.function.accessor.setter")
KIND(RefAccessorSetter, "source.lang.swift.ref.function.accessor.setter")
KIND(DeclAccessorWillSet, "source.lang.swift.decl.function.accessor.willset")
KIND(RefAccessorWillSet, "source.lang.swift.ref.function.accessor.willset")
KIND(DeclAccessorDidSet, "source.lang.swift.decl.function.accessor.didset")
KIND(RefAccessorDidSet, "source.lang.swift.ref.function.accessor.didset")
KIND(DeclAccessorAddress, "source.lang.swift.decl.function.accessor.address")
KIND(RefAccessorAddress, "source.lang.swift.ref.function.accessor.address")
KIND(DeclAccessorMutableAddress, "source.lang.swift.decl.function.accessor.mutableaddress")
KIND(RefAccessorMutableAddress, "source.lang.swift.ref.function.accessor.mutableaddress")
KIND(DeclConstructor, "source.lang.swift.decl.function.constructor")
KIND(RefConstructor, "source.lang.swift.ref.function.constructor")
KIND(DeclDestructor, "source.lang.swift.decl.function.destructor")
KIND(RefDestructor, "source.lang.swift.ref.function.destructor")
KIND(DeclFunctionPrefixOperator, "source.lang.swift.decl.function.operator.prefix")
KIND(DeclFunctionPostfixOperator, "source.lang.swift.decl.function.operator.postfix")
KIND(DeclFunctionInfixOperator, "source.lang.swift.decl.function.operator.infix")
KIND(RefFunctionPrefixOperator, "source.lang.swift.ref.function.operator.prefix")
KIND(RefFunctionPostfixOperator, "source.lang.swift.ref.function.operator.postfix")
KIND(RefFunctionInfixOperator, "source.lang.swift.ref.function.operator.infix")
KIND(DeclPrecedenceGroup, "source.lang.swift.decl.precedencegroup")
KIND(RefPrecedenceGroup, "source.lang.swift.ref.precedencegroup")
KIND(DeclSubscript, "source.lang.swift.decl.function.subscript")
KIND(RefSubscript, "source.lang.swift.ref.function.subscript")
KIND(DeclVarGlobal, "source.lang.swift.decl.var.global")
KIND(RefVarGlobal, "source.lang.swift.ref.var.global")
KIND(DeclVarInstance, "source.lang.swift.decl.var.instance")
KIND(RefVarInstance, "source.lang.swift.ref.var.instance")
KIND(DeclVarStatic, "source.lang.swift.decl.var.static")
KIND(RefVarStatic, "source.lang.swift.ref.var.static")
KIND(DeclVarClass, "source.lang.swift.decl.var.class")
KIND(RefVarClass, "source.lang.swift.ref.var.class")
KIND(DeclVarLocal, "source.lang.swift.decl.var.local")
KIND(RefVarLocal, "source.lang.swift.ref.var.local")
KIND(DeclVarParam, "source.lang.swift.decl.var.parameter")
KIND(DeclModule, "source.lang.swift.decl.module")
KIND(DeclClass, "source.lang.swift.decl.class")
KIND(RefClass, "source.lang.swift.ref.class")
KIND(DeclStruct, "source.lang.swift.decl.struct")
KIND(RefStruct, "source.lang.swift.ref.struct")
KIND(DeclEnum, "source.lang.swift.decl.enum")
KIND(RefEnum, "source.lang.swift.ref.enum")
KIND(DeclEnumCase, "source.lang.swift.decl.enumcase")
KIND(DeclEnumElement, "source.lang.swift.decl.enumelement")
KIND(RefEnumElement, "source.lang.swift.ref.enumelement")
KIND(DeclProtocol, "source.lang.swift.decl.protocol")
KIND(RefProtocol, "source.lang.swift.ref.protocol")
KIND(DeclExtension, "source.lang.swift.decl.extension")
KIND(DeclExtensionStruct, "source.lang.swift.decl.extension.struct")
KIND(DeclExtensionClass, "source.lang.swift.decl.extension.class")
KIND(DeclExtensionEnum, "source.lang.swift.decl.extension.enum")
KIND(DeclExtensionProtocol, "source.lang.swift.decl.extension.protocol")
KIND(DeclAssociatedType, "source.lang.swift.decl.associatedtype")
KIND(RefAssociatedType, "source.lang.swift.ref.associatedtype")
KIND(DeclTypeAlias, "source.lang.swift.decl.typealias")
KIND(RefTypeAlias, "source.lang.swift.ref.typealias")
KIND(DeclGenericTypeParam, "source.lang.swift.decl.generic_type_param")
KIND(RefGenericTypeParam, "source.lang.swift.ref.generic_type_param")
KIND(RefModule, "source.lang.swift.ref.module")
KIND(StmtForEach, "source.lang.swift.stmt.foreach")
KIND(StmtFor, "source.lang.swift.stmt.for")
KIND(StmtWhile, "source.lang.swift.stmt.while")
KIND(StmtRepeatWhile, "source.lang.swift.stmt.repeatwhile")
KIND(StmtIf, "source.lang.swift.stmt.if")
KIND(StmtGuard, "source.lang.swift.stmt.guard")
KIND(StmtSwitch, "source.lang.swift.stmt.switch")
KIND(StmtCase, "source.lang.swift.stmt.case")
KIND(StmtBrace, "source.lang.swift.stmt.brace")
KIND(ExprCall, "source.lang.swift.expr.call")
KIND(ExprArg, "source.lang.swift.expr.argument")
KIND(ExprArray, "source.lang.swift.expr.array")
KIND(ExprDictionary, "source.lang.swift.expr.dictionary")
KIND(ExprObjectLiteral, "source.lang.swift.expr.object_literal")
KIND(StructureElemId, "source.lang.swift.structure.elem.id")
KIND(StructureElemExpr, "source.lang.swift.structure.elem.expr")
KIND(StructureElemInitExpr, "source.lang.swift.structure.elem.init_expr")
KIND(StructureElemCondExpr, "source.lang.swift.structure.elem.condition_expr")
KIND(StructureElemPattern, "source.lang.swift.structure.elem.pattern")
KIND(StructureElemTypeRef, "source.lang.swift.structure.elem.typeref")
KIND(RangeSingleStatement, "source.lang.swift.range.singlestatement")
KIND(RangeSingleExpression, "source.lang.swift.range.singleexpression")
KIND(RangeSingleDeclaration, "source.lang.swift.range.singledeclaration")
KIND(RangeMultiStatement, "source.lang.swift.range.multistatement")
KIND(RangeInvalid, "source.lang.swift.range.invalid")
KIND(NameObjc, "source.lang.name.kind.objc")
KIND(NameSwift, "source.lang.name.kind.swift")
KIND(Keyword, "source.lang.swift.syntaxtype.keyword")
KIND(Identifier, "source.lang.swift.syntaxtype.identifier")
KIND(TypeIdentifier, "source.lang.swift.syntaxtype.typeidentifier")
KIND(BuildConfigKeyword, "source.lang.swift.syntaxtype.buildconfig.keyword")
KIND(BuildConfigId, "source.lang.swift.syntaxtype.buildconfig.id")
KIND(AttributeId, "source.lang.swift.syntaxtype.attribute.id")
KIND(AttributeBuiltin, "source.lang.swift.syntaxtype.attribute.builtin")
KIND(Number, "source.lang.swift.syntaxtype.number")
KIND(String, "source.lang.swift.syntaxtype.string")
KIND(StringInterpolation, "source.lang.swift.syntaxtype.string_interpolation_anchor")
KIND(Comment, "source.lang.swift.syntaxtype.comment")
KIND(DocComment, "source.lang.swift.syntaxtype.doccomment")
KIND(DocCommentField, "source.lang.swift.syntaxtype.doccomment.field")
KIND(CommentMarker, "source.lang.swift.syntaxtype.comment.mark")
KIND(CommentURL, "source.lang.swift.syntaxtype.comment.url")
KIND(Placeholder, "source.lang.swift.syntaxtype.placeholder")
KIND(ObjectLiteral, "source.lang.swift.syntaxtype.objectliteral")
KIND(Expr, "source.lang.swift.expr")
KIND(Stmt, "source.lang.swift.stmt")
KIND(Type, "source.lang.swift.type")
KIND(DiagNote, "source.diagnostic.severity.note")
KIND(DiagWarning, "source.diagnostic.severity.warning")
KIND(DiagError, "source.diagnostic.severity.error")
KIND(CodeCompletionKeyword, "source.codecompletion.keyword")
KIND(CodeCompletionEverything, "source.codecompletion.everything")
KIND(CodeCompletionModule, "source.codecompletion.module")
KIND(CodeCompletionCodeCompleteKeyword, "source.codecompletion.keyword")
KIND(CodeCompletionLiteral, "source.codecompletion.literal")
KIND(CodeCompletionCustom, "source.codecompletion.custom")
KIND(CodeCompletionIdentifier, "source.codecompletion.identifier")
KIND(CodeCompletionDescription, "source.codecompletion.description")
#undef KIND
#undef REQUEST
#undef KEY

View File

@@ -52,126 +52,8 @@ using swift::index::SymbolInfo;
using swift::index::SymbolRole;
using swift::index::SymbolRoleSet;
static UIdent KindDeclFunctionFree("source.lang.swift.decl.function.free");
static UIdent KindRefFunctionFree("source.lang.swift.ref.function.free");
static UIdent KindDeclMethodInstance(
"source.lang.swift.decl.function.method.instance");
static UIdent KindRefMethodInstance(
"source.lang.swift.ref.function.method.instance");
static UIdent KindDeclMethodStatic(
"source.lang.swift.decl.function.method.static");
static UIdent KindRefMethodStatic(
"source.lang.swift.ref.function.method.static");
static UIdent KindDeclMethodClass(
"source.lang.swift.decl.function.method.class");
static UIdent KindRefMethodClass(
"source.lang.swift.ref.function.method.class");
static UIdent KindDeclAccessorGetter(
"source.lang.swift.decl.function.accessor.getter");
static UIdent KindRefAccessorGetter(
"source.lang.swift.ref.function.accessor.getter");
static UIdent KindDeclAccessorSetter(
"source.lang.swift.decl.function.accessor.setter");
static UIdent KindRefAccessorSetter(
"source.lang.swift.ref.function.accessor.setter");
static UIdent KindDeclAccessorWillSet(
"source.lang.swift.decl.function.accessor.willset");
static UIdent KindRefAccessorWillSet(
"source.lang.swift.ref.function.accessor.willset");
static UIdent KindDeclAccessorDidSet(
"source.lang.swift.decl.function.accessor.didset");
static UIdent KindRefAccessorDidSet(
"source.lang.swift.ref.function.accessor.didset");
static UIdent KindDeclAccessorAddress(
"source.lang.swift.decl.function.accessor.address");
static UIdent KindRefAccessorAddress(
"source.lang.swift.ref.function.accessor.address");
static UIdent KindDeclAccessorMutableAddress(
"source.lang.swift.decl.function.accessor.mutableaddress");
static UIdent KindRefAccessorMutableAddress(
"source.lang.swift.ref.function.accessor.mutableaddress");
static UIdent KindDeclConstructor("source.lang.swift.decl.function.constructor");
static UIdent KindRefConstructor("source.lang.swift.ref.function.constructor");
static UIdent KindDeclDestructor("source.lang.swift.decl.function.destructor");
static UIdent KindRefDestructor("source.lang.swift.ref.function.destructor");
static UIdent KindDeclFunctionPrefixOperator("source.lang.swift.decl.function.operator.prefix");
static UIdent KindDeclFunctionPostfixOperator("source.lang.swift.decl.function.operator.postfix");
static UIdent KindDeclFunctionInfixOperator("source.lang.swift.decl.function.operator.infix");
static UIdent KindRefFunctionPrefixOperator("source.lang.swift.ref.function.operator.prefix");
static UIdent KindRefFunctionPostfixOperator("source.lang.swift.ref.function.operator.postfix");
static UIdent KindRefFunctionInfixOperator("source.lang.swift.ref.function.operator.infix");
static UIdent KindDeclPrecedenceGroup("source.lang.swift.decl.precedencegroup");
static UIdent KindRefPrecedenceGroup("source.lang.swift.ref.precedencegroup");
static UIdent KindDeclSubscript("source.lang.swift.decl.function.subscript");
static UIdent KindRefSubscript("source.lang.swift.ref.function.subscript");
static UIdent KindDeclVarGlobal("source.lang.swift.decl.var.global");
static UIdent KindRefVarGlobal("source.lang.swift.ref.var.global");
static UIdent KindDeclVarInstance("source.lang.swift.decl.var.instance");
static UIdent KindRefVarInstance("source.lang.swift.ref.var.instance");
static UIdent KindDeclVarStatic("source.lang.swift.decl.var.static");
static UIdent KindRefVarStatic("source.lang.swift.ref.var.static");
static UIdent KindDeclVarClass("source.lang.swift.decl.var.class");
static UIdent KindRefVarClass("source.lang.swift.ref.var.class");
static UIdent KindDeclVarLocal("source.lang.swift.decl.var.local");
static UIdent KindRefVarLocal("source.lang.swift.ref.var.local");
static UIdent KindDeclVarParam("source.lang.swift.decl.var.parameter");
static UIdent KindDeclModule("source.lang.swift.decl.module");
static UIdent KindDeclClass("source.lang.swift.decl.class");
static UIdent KindRefClass("source.lang.swift.ref.class");
static UIdent KindDeclStruct("source.lang.swift.decl.struct");
static UIdent KindRefStruct("source.lang.swift.ref.struct");
static UIdent KindDeclEnum("source.lang.swift.decl.enum");
static UIdent KindRefEnum("source.lang.swift.ref.enum");
static UIdent KindDeclEnumCase("source.lang.swift.decl.enumcase");
static UIdent KindDeclEnumElement("source.lang.swift.decl.enumelement");
static UIdent KindRefEnumElement("source.lang.swift.ref.enumelement");
static UIdent KindDeclProtocol("source.lang.swift.decl.protocol");
static UIdent KindRefProtocol("source.lang.swift.ref.protocol");
static UIdent KindDeclExtension("source.lang.swift.decl.extension");
static UIdent KindDeclExtensionStruct("source.lang.swift.decl.extension.struct");
static UIdent KindDeclExtensionClass("source.lang.swift.decl.extension.class");
static UIdent KindDeclExtensionEnum("source.lang.swift.decl.extension.enum");
static UIdent KindDeclExtensionProtocol("source.lang.swift.decl.extension.protocol");
static UIdent KindDeclAssociatedType("source.lang.swift.decl.associatedtype");
static UIdent KindRefAssociatedType("source.lang.swift.ref.associatedtype");
static UIdent KindDeclTypeAlias("source.lang.swift.decl.typealias");
static UIdent KindRefTypeAlias("source.lang.swift.ref.typealias");
static UIdent KindDeclGenericTypeParam("source.lang.swift.decl.generic_type_param");
static UIdent KindRefGenericTypeParam("source.lang.swift.ref.generic_type_param");
static UIdent KindRefModule("source.lang.swift.ref.module");
static UIdent KindStmtForEach("source.lang.swift.stmt.foreach");
static UIdent KindStmtFor("source.lang.swift.stmt.for");
static UIdent KindStmtWhile("source.lang.swift.stmt.while");
static UIdent KindStmtRepeatWhile("source.lang.swift.stmt.repeatwhile");
static UIdent KindStmtIf("source.lang.swift.stmt.if");
static UIdent KindStmtGuard("source.lang.swift.stmt.guard");
static UIdent KindStmtSwitch("source.lang.swift.stmt.switch");
static UIdent KindStmtCase("source.lang.swift.stmt.case");
static UIdent KindStmtBrace("source.lang.swift.stmt.brace");
static UIdent KindExprCall("source.lang.swift.expr.call");
static UIdent KindExprArg("source.lang.swift.expr.argument");
static UIdent KindExprArray("source.lang.swift.expr.array");
static UIdent KindExprDictionary("source.lang.swift.expr.dictionary");
static UIdent KindExprObjectLiteral("source.lang.swift.expr.object_literal");
static UIdent KindStructureElemId("source.lang.swift.structure.elem.id");
static UIdent KindStructureElemExpr("source.lang.swift.structure.elem.expr");
static UIdent KindStructureElemInitExpr("source.lang.swift.structure.elem.init_expr");
static UIdent KindStructureElemCondExpr("source.lang.swift.structure.elem.condition_expr");
static UIdent KindStructureElemPattern("source.lang.swift.structure.elem.pattern");
static UIdent KindStructureElemTypeRef("source.lang.swift.structure.elem.typeref");
static UIdent KindRangeSingleStatement("source.lang.swift.range.singlestatement");
static UIdent KindRangeSingleExpression("source.lang.swift.range.singleexpression");
static UIdent KindRangeSingleDeclaration("source.lang.swift.range.singledeclaration");
static UIdent KindRangeMultiStatement("source.lang.swift.range.multistatement");
static UIdent KindRangeInvalid("source.lang.swift.range.invalid");
static UIdent KindNameObjc("source.lang.name.kind.objc");
static UIdent KindNameSwift("source.lang.name.kind.swift");
#define KIND(NAME, CONTENT) static UIdent Kind##NAME(CONTENT);
#include "SourceKit/Core/ProtocolUIDs.def"
std::unique_ptr<LangSupport>
SourceKit::createSwiftLangSupport(SourceKit::Context &SKCtx) {
@@ -416,24 +298,6 @@ UIdent SwiftLangSupport::getUIDForCodeCompletionDeclKind(
}
UIdent SwiftLangSupport::getUIDForSyntaxNodeKind(SyntaxNodeKind SC) {
static UIdent KindKeyword("source.lang.swift.syntaxtype.keyword");
static UIdent KindIdentifier("source.lang.swift.syntaxtype.identifier");
static UIdent KindTypeIdentifier("source.lang.swift.syntaxtype.typeidentifier");
static UIdent KindBuildConfigKeyword("source.lang.swift.syntaxtype.buildconfig.keyword");
static UIdent KindBuildConfigId("source.lang.swift.syntaxtype.buildconfig.id");
static UIdent KindAttributeId("source.lang.swift.syntaxtype.attribute.id");
static UIdent KindAttributeBuiltin("source.lang.swift.syntaxtype.attribute.builtin");
static UIdent KindNumber("source.lang.swift.syntaxtype.number");
static UIdent KindString("source.lang.swift.syntaxtype.string");
static UIdent KindStringInterpolation("source.lang.swift.syntaxtype.string_interpolation_anchor");
static UIdent KindComment("source.lang.swift.syntaxtype.comment");
static UIdent KindDocComment("source.lang.swift.syntaxtype.doccomment");
static UIdent KindDocCommentField("source.lang.swift.syntaxtype.doccomment.field");
static UIdent KindCommentMarker("source.lang.swift.syntaxtype.comment.mark");
static UIdent KindCommentURL("source.lang.swift.syntaxtype.comment.url");
static UIdent KindPlaceholder("source.lang.swift.syntaxtype.placeholder");
static UIdent KindObjectLiteral("source.lang.swift.syntaxtype.objectliteral");
switch (SC) {
case SyntaxNodeKind::Keyword:
return KindKeyword;

View File

@@ -87,18 +87,14 @@ static void notification_receiver(sourcekitd_response_t resp);
static SourceKitRequest ActiveRequest = SourceKitRequest::None;
#define KEY(NAME, CONTENT) static sourcekitd_uid_t Key##NAME;
#include "SourceKit/Core/ProtocolUIDs.def"
#define REQUEST(NAME, CONTENT) static sourcekitd_uid_t Request##NAME;
#define KIND(NAME, CONTENT) static sourcekitd_uid_t Kind##NAME;
#include "SourceKit/Core/ProtocolUIDs.def"
static sourcekitd_uid_t SemaDiagnosticStage;
static sourcekitd_uid_t NoteDocUpdate;
static sourcekitd_uid_t KindNameObjc;
static sourcekitd_uid_t KindNameSwift;
static SourceKit::Semaphore semaSemaphore(0);
static sourcekitd_response_t semaResponse;
static const char *semaName;
@@ -143,11 +139,9 @@ static int skt_main(int argc, const char **argv) {
NoteDocUpdate = sourcekitd_uid_get_from_cstr("source.notification.editor.documentupdate");
#define REQUEST(NAME, CONTENT) Request##NAME = sourcekitd_uid_get_from_cstr(CONTENT);
#define KIND(NAME, CONTENT) Kind##NAME = sourcekitd_uid_get_from_cstr(CONTENT);
#include "SourceKit/Core/ProtocolUIDs.def"
KindNameObjc = sourcekitd_uid_get_from_cstr("source.lang.name.kind.objc");
KindNameSwift = sourcekitd_uid_get_from_cstr("source.lang.name.kind.swift");
// A test invocation may initialize the options to be used for subsequent
// invocations.
TestOptions InitOpts;

View File

@@ -61,35 +61,17 @@ public:
operator sourcekitd_uid_t() const {
return get();
}
StringRef str() const {
return StringRef(Name);
}
};
} // anonymous namespace
#define REQUEST(NAME, CONTENT) static LazySKDUID Request##NAME(CONTENT);
#define KIND(NAME, CONTENT) static LazySKDUID Kind##NAME(CONTENT);
#include "SourceKit/Core/ProtocolUIDs.def"
static LazySKDUID KindExpr("source.lang.swift.expr");
static LazySKDUID KindStmt("source.lang.swift.stmt");
static LazySKDUID KindType("source.lang.swift.type");
static LazySKDUID KindEverything("source.codecompletion.everything");
static LazySKDUID KindModule("source.codecompletion.module");
static LazySKDUID KindKeyword("source.codecompletion.keyword");
static LazySKDUID KindLiteral("source.codecompletion.literal");
static LazySKDUID KindCustom("source.codecompletion.custom");
static LazySKDUID KindIdentifier("source.codecompletion.identifier");
static LazySKDUID KindDescription("source.codecompletion.description");
static UIdent DiagKindNote("source.diagnostic.severity.note");
static UIdent DiagKindWarning("source.diagnostic.severity.warning");
static UIdent DiagKindError("source.diagnostic.severity.error");
static UIdent KindNameObjc("source.lang.name.kind.objc");
static UIdent KindNameSwift("source.lang.name.kind.swift");
static LazySKDUID SwiftNameKind("source.lang.name.kind.swift");
static LazySKDUID ObjcNameKind("source.lang.name.kind.objc");
static void onDocumentUpdateNotification(StringRef DocumentName) {
static UIdent DocumentUpdateNotificationUID(
"source.notification.editor.documentupdate");
@@ -770,10 +752,10 @@ handleSemanticRequest(RequestDict Req,
if (!NK) {
return Rec(createErrorRequestInvalid("'key.namekind' is required"));
}
if (NK == SwiftNameKind)
Input.NameKind = KindNameSwift;
else if (NK == ObjcNameKind)
Input.NameKind = KindNameObjc;
if (NK == KindNameSwift.get())
Input.NameKind = UIdent(KindNameSwift.str());
else if (NK == KindNameObjc.get())
Input.NameKind = UIdent(KindNameObjc.str());
else
return Rec(createErrorRequestInvalid("'key.namekind' is unrecognizable"));
if (auto Base = Req.getString(KeyBaseName)) {
@@ -1330,10 +1312,10 @@ bool SKDocConsumer::handleDiagnostic(const DiagnosticEntryInfo &Info) {
UIdent SeverityUID;
switch (Info.Severity) {
case DiagnosticSeverityKind::Warning:
SeverityUID = DiagKindWarning;
SeverityUID = UIdent(KindDiagWarning.str());
break;
case DiagnosticSeverityKind::Error:
SeverityUID = DiagKindError;
SeverityUID = UIdent(KindDiagError.str());
break;
}
@@ -1344,7 +1326,7 @@ bool SKDocConsumer::handleDiagnostic(const DiagnosticEntryInfo &Info) {
auto NotesArr = Elem.setArray(KeyDiagnostics);
for (auto &NoteDiag : Info.Notes) {
auto NoteElem = NotesArr.appendDictionary();
NoteElem.set(KeySeverity, DiagKindNote);
NoteElem.set(KeySeverity, KindDiagNote);
fillDictionaryForDiagnosticInfo(NoteElem, NoteDiag);
}
}
@@ -1471,8 +1453,8 @@ static void reportNameInfo(const NameTranslatingInfo &Info, ResponseReceiver Rec
Elem.set(KeyBaseName, Info.BaseName);
}
if (!Info.ArgNames.empty()) {
auto Arr = Elem.setArray(Info.NameKind == KindNameSwift ? KeyArgNames :
KeySelectorPieces);
auto Arr = Elem.setArray(Info.NameKind == UIdent(KindNameSwift.str()) ?
KeyArgNames : KeySelectorPieces);
for (auto N : Info.ArgNames) {
auto NameEle = Arr.appendDictionary();
NameEle.set(KeyName, N);
@@ -1662,19 +1644,19 @@ static sourcekitd_response_t codeCompleteOpen(StringRef Name,
optionsDict->dictionaryArrayApply(KeyFilterRules, [&](RequestDict dict) {
FilterRule rule;
auto kind = dict.getUID(KeyKind);
if (kind == KindEverything) {
if (kind == KindCodeCompletionEverything) {
rule.kind = FilterRule::Everything;
} else if (kind == KindModule) {
} else if (kind == KindCodeCompletionModule) {
rule.kind = FilterRule::Module;
} else if (kind == KindKeyword) {
} else if (kind == KindCodeCompletionKeyword) {
rule.kind = FilterRule::Keyword;
} else if (kind == KindLiteral) {
} else if (kind == KindCodeCompletionLiteral) {
rule.kind = FilterRule::Literal;
} else if (kind == KindCustom) {
} else if (kind == KindCodeCompletionCustom) {
rule.kind = FilterRule::CustomCompletion;
} else if (kind == KindIdentifier) {
} else if (kind == KindCodeCompletionIdentifier) {
rule.kind = FilterRule::Identifier;
} else if (kind == KindDescription) {
} else if (kind == KindCodeCompletionDescription) {
rule.kind = FilterRule::Description;
} else {
// Warning: unknown
@@ -2224,10 +2206,10 @@ bool SKEditorConsumer::handleDiagnostic(const DiagnosticEntryInfo &Info,
UIdent SeverityUID;
switch (Info.Severity) {
case DiagnosticSeverityKind::Warning:
SeverityUID = DiagKindWarning;
SeverityUID = UIdent(KindDiagWarning.str());
break;
case DiagnosticSeverityKind::Error:
SeverityUID = DiagKindError;
SeverityUID = UIdent(KindDiagError.str());
break;
}
@@ -2239,7 +2221,7 @@ bool SKEditorConsumer::handleDiagnostic(const DiagnosticEntryInfo &Info,
auto NotesArr = Elem.setArray(KeyDiagnostics);
for (auto &NoteDiag : Info.Notes) {
auto NoteElem = NotesArr.appendDictionary();
NoteElem.set(KeySeverity, DiagKindNote);
NoteElem.set(KeySeverity, KindDiagNote);
fillDictionaryForDiagnosticInfo(NoteElem, NoteDiag);
}
}