mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SourceKit] Use keyword name context to add syntaxtype.keyword tags
We can now markup most keyword uses. Still missing access control keywords. rdar://problem/24292226
This commit is contained in:
@@ -67,6 +67,7 @@ static StringRef getTagForDecl(const Decl *D, bool isRef) {
|
||||
|
||||
static StringRef ExternalParamNameTag = "decl.var.parameter.argument_label";
|
||||
static StringRef LocalParamNameTag = "decl.var.parameter.name";
|
||||
static StringRef SyntaxKeywordTag = "syntaxtype.keyword";
|
||||
|
||||
static StringRef getTagForPrintNameContext(PrintNameContext context) {
|
||||
switch (context) {
|
||||
@@ -74,6 +75,8 @@ static StringRef getTagForPrintNameContext(PrintNameContext context) {
|
||||
return ExternalParamNameTag;
|
||||
case PrintNameContext::FunctionParameterLocal:
|
||||
return LocalParamNameTag;
|
||||
case PrintNameContext::Keyword:
|
||||
return SyntaxKeywordTag;
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
@@ -97,7 +100,7 @@ static StringRef getDeclNameTagForDecl(const Decl *D) {
|
||||
case DeclKind::Destructor:
|
||||
case DeclKind::Subscript:
|
||||
// The names 'init'/'deinit'/'subscript' are actually keywords.
|
||||
return "syntaxtype.keyword";
|
||||
return SyntaxKeywordTag;
|
||||
default:
|
||||
return "decl.name";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user