Skip to content

Commit 3f3dd29

Browse files
Use isWhitespace in getIfElseOccurrences.
1 parent 38d7ba6 commit 3f3dd29

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/services/services.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2230,7 +2230,7 @@ module ts {
22302230

22312231
var result: ReferenceEntry[] = [];
22322232

2233-
// We'd like to highlight else/ifs together if they are only separated by spaces/tabs
2233+
// We'd like to highlight else/ifs together if they are only separated by whitespace
22342234
// (i.e. the keywords are separated by no comments, no newlines).
22352235
for (var i = 0; i < keywords.length; i++) {
22362236
if (keywords[i].kind === SyntaxKind.ElseKeyword && i < keywords.length - 1) {
@@ -2241,8 +2241,7 @@ module ts {
22412241

22422242
// Avoid recalculating getStart() by iterating backwards.
22432243
for (var j = ifKeyword.getStart() - 1; j >= elseKeyword.end; j--) {
2244-
var c = sourceFile.text.charCodeAt(j);
2245-
if (c !== CharacterCodes.space && c !== CharacterCodes.tab) {
2244+
if (!isWhiteSpace(sourceFile.text.charCodeAt(j))) {
22462245
shouldHighlightNextKeyword = false;
22472246
break;
22482247
}

0 commit comments

Comments
 (0)