diff --git a/src/services/completions.ts b/src/services/completions.ts index a070bf8f7c1..4c1b3db1af9 100644 --- a/src/services/completions.ts +++ b/src/services/completions.ts @@ -703,6 +703,14 @@ namespace ts.Completions { case SyntaxKind.PropertyAccessExpression: propertyAccessToConvert = parent as PropertyAccessExpression; node = propertyAccessToConvert.expression; + if (node.end === contextToken.pos && + isCallExpression(node) && + node.getChildCount(sourceFile) && + last(node.getChildren(sourceFile)).kind !== SyntaxKind.CloseParenToken) { + // This is likely dot from incorrectly parsed call expression and user is starting to write spread + // eg: Math.min(./**/) + return undefined; + } break; case SyntaxKind.QualifiedName: node = (parent as QualifiedName).left; diff --git a/tests/cases/fourslash/completionsWritingSpreadArgument.ts b/tests/cases/fourslash/completionsWritingSpreadArgument.ts new file mode 100644 index 00000000000..5fd4eaad179 --- /dev/null +++ b/tests/cases/fourslash/completionsWritingSpreadArgument.ts @@ -0,0 +1,12 @@ +/// + +//// +//// const [] = [Math.min(./*marker*/)] +//// + +goTo.marker("marker"); +verify.completions({ exact: undefined }); +edit.insert("."); +verify.completions({ exact: undefined }); +edit.insert("."); +verify.completions({ exact: completion.globals });