Skip to content

Commit 12d736f

Browse files
committed
Fix completions when writing spread expression
Fixes #29234
1 parent b762d62 commit 12d736f

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/services/completions.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,14 @@ namespace ts.Completions {
703703
case SyntaxKind.PropertyAccessExpression:
704704
propertyAccessToConvert = parent as PropertyAccessExpression;
705705
node = propertyAccessToConvert.expression;
706+
if (node.end === contextToken.pos &&
707+
isCallExpression(node) &&
708+
node.getChildCount(sourceFile) &&
709+
last(node.getChildren(sourceFile)).kind !== SyntaxKind.CloseParenToken) {
710+
// This is likely dot from incorrectly parsed call expression and user is starting to write spread
711+
// eg: Math.min(./**/)
712+
return undefined;
713+
}
706714
break;
707715
case SyntaxKind.QualifiedName:
708716
node = (parent as QualifiedName).left;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
////
4+
//// const [] = [Math.min(./*marker*/)]
5+
////
6+
7+
goTo.marker("marker");
8+
verify.completions({ exact: undefined });
9+
edit.insert(".");
10+
verify.completions({ exact: undefined });
11+
edit.insert(".");
12+
verify.completions({ exact: completion.globals });

0 commit comments

Comments
 (0)