findPrecedingToken handles EOF child more gracefully

This commit is contained in:
Arthur Ozga committed 2017-08-15 12:09:02 -07:00
1 parent 472ad9d313
commit f3e0cbbd52
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -113,7 +113,7 @@ namespace ts {
}
pos = textPos;
if (token === SyntaxKind.EndOfFileToken) {
return pos;
break;
}
}
return pos;
+1 -1
View File
@@ -753,7 +753,7 @@ namespace ts {
const start = child.getStart(sourceFile, includeJsDoc);
const lookInPreviousChild =
(start >= position) || // cursor in the leading trivia
nodeHasTokens(child) ||
!nodeHasTokens(child) ||
(child.kind === SyntaxKind.JsxText && start === child.end); // whitespace only JsxText
if (lookInPreviousChild) {