[IDE] Handle '@unknown' attribute in syntax map

`@unknown` is so far the only attribute for statement. Handle it
specially in syntax-map.

rdar://problem/47855035 / https://bugs.swift.org/browse/SR-9873
This commit is contained in:
Rintaro Ishizaki
2019-02-06 11:23:53 -08:00
parent 1e7fba716d
commit d4c3ee6b49
2 changed files with 6 additions and 1 deletions

View File

@@ -67,8 +67,10 @@ SyntaxModelContext::SyntaxModelContext(SourceFile &SrcFile)
Optional<unsigned> Length;
if (AttrLoc.isValid()) {
// This token is following @, see if it's a known attribute name.
// Type attribute, decl attribute, or '@unknown' for swift case statement.
if (TypeAttributes::getAttrKindFromString(Tok.getText()) != TAK_Count ||
DeclAttribute::getAttrKindFromString(Tok.getText()) != DAK_Count) {
DeclAttribute::getAttrKindFromString(Tok.getText()) != DAK_Count ||
Tok.getText() == "unknown") {
// It's a known attribute, so treat it as a syntactic attribute node for
// syntax coloring. If swift gets user attributes then all identifiers
// will be treated as syntactic attribute nodes.