Skip to content

Commit a2d0d59

Browse files
Merge pull request microsoft#1998 from Microsoft/newLineClassification
Classify newlines as whitespace in the classifier.
2 parents 60a6b28 + 6893a2c commit a2d0d59

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

src/services/services.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5694,25 +5694,25 @@ module ts {
56945694
}
56955695
}
56965696
else if (lastNonTriviaToken === SyntaxKind.DotToken && isKeyword(token)) {
5697-
token = SyntaxKind.Identifier;
5697+
token = SyntaxKind.Identifier;
56985698
}
56995699
else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) {
5700-
// We have two keywords in a row. Only treat the second as a keyword if
5701-
// it's a sequence that could legally occur in the language. Otherwise
5702-
// treat it as an identifier. This way, if someone writes "private var"
5703-
// we recognize that 'var' is actually an identifier here.
5704-
token = SyntaxKind.Identifier;
5700+
// We have two keywords in a row. Only treat the second as a keyword if
5701+
// it's a sequence that could legally occur in the language. Otherwise
5702+
// treat it as an identifier. This way, if someone writes "private var"
5703+
// we recognize that 'var' is actually an identifier here.
5704+
token = SyntaxKind.Identifier;
57055705
}
57065706
else if (lastNonTriviaToken === SyntaxKind.Identifier &&
57075707
token === SyntaxKind.LessThanToken) {
5708-
// Could be the start of something generic. Keep track of that by bumping
5709-
// up the current count of generic contexts we may be in.
5710-
angleBracketStack++;
5708+
// Could be the start of something generic. Keep track of that by bumping
5709+
// up the current count of generic contexts we may be in.
5710+
angleBracketStack++;
57115711
}
57125712
else if (token === SyntaxKind.GreaterThanToken && angleBracketStack > 0) {
5713-
// If we think we're currently in something generic, then mark that that
5714-
// generic entity is complete.
5715-
angleBracketStack--;
5713+
// If we think we're currently in something generic, then mark that that
5714+
// generic entity is complete.
5715+
angleBracketStack--;
57165716
}
57175717
else if (token === SyntaxKind.AnyKeyword ||
57185718
token === SyntaxKind.StringKeyword ||
@@ -5873,7 +5873,8 @@ module ts {
58735873
case SyntaxKind.EqualsToken:
58745874
case SyntaxKind.CommaToken:
58755875
return true;
5876-
default: return false;
5876+
default:
5877+
return false;
58775878
}
58785879
}
58795880

@@ -5918,6 +5919,7 @@ module ts {
59185919
case SyntaxKind.SingleLineCommentTrivia:
59195920
return TokenClass.Comment;
59205921
case SyntaxKind.WhitespaceTrivia:
5922+
case SyntaxKind.NewLineTrivia:
59215923
return TokenClass.Whitespace;
59225924
case SyntaxKind.Identifier:
59235925
default:

0 commit comments

Comments
 (0)