Filter out empty access expression
This commit is contained in:
parent
e1a2b9ed19
commit
51881c4ea2
|
@ -1338,13 +1338,16 @@ namespace ts.Completions {
|
|||
case SyntaxKind.PropertyAccessExpression:
|
||||
propertyAccessToConvert = parent as PropertyAccessExpression;
|
||||
node = propertyAccessToConvert.expression;
|
||||
if ((isCallExpression(node) || isFunctionLike(node)) &&
|
||||
node.end === contextToken.pos &&
|
||||
node.getChildCount(sourceFile) &&
|
||||
last(node.getChildren(sourceFile)).kind !== SyntaxKind.CloseParenToken) {
|
||||
const leftMostAccessExpression = getLeftmostAccessExpression(parent as Expression);
|
||||
if (leftMostAccessExpression.pos === leftMostAccessExpression.end ||
|
||||
((isCallExpression(node) || isFunctionLike(node)) &&
|
||||
node.end === contextToken.pos &&
|
||||
node.getChildCount(sourceFile) &&
|
||||
last(node.getChildren(sourceFile)).kind !== SyntaxKind.CloseParenToken)) {
|
||||
// This is likely dot from incorrectly parsed expression and user is starting to write spread
|
||||
// eg: Math.min(./**/)
|
||||
// const x = function (./**/) {}
|
||||
// ({./**/})
|
||||
return undefined;
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue