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…
Reference in a new issue