Skip to content

Commit f3e0cbb

Browse files
committed
findPrecedingToken handles EOF child more gracefully
1 parent 472ad9d commit f3e0cbb

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/services/services.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ namespace ts {
113113
}
114114
pos = textPos;
115115
if (token === SyntaxKind.EndOfFileToken) {
116-
return pos;
116+
break;
117117
}
118118
}
119119
return pos;

src/services/utilities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ namespace ts {
753753
const start = child.getStart(sourceFile, includeJsDoc);
754754
const lookInPreviousChild =
755755
(start >= position) || // cursor in the leading trivia
756-
nodeHasTokens(child) ||
756+
!nodeHasTokens(child) ||
757757
(child.kind === SyntaxKind.JsxText && start === child.end); // whitespace only JsxText
758758

759759
if (lookInPreviousChild) {

0 commit comments

Comments
 (0)