mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-14 19:16:17 -06:00
findPrecedingToken handles EOF child more gracefully
This commit is contained in:
parent
472ad9d313
commit
f3e0cbbd52
@ -113,7 +113,7 @@ namespace ts {
|
||||
}
|
||||
pos = textPos;
|
||||
if (token === SyntaxKind.EndOfFileToken) {
|
||||
return pos;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return pos;
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user