Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/services/completions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(propertyAccessToConvert);
if (nodeIsMissing(leftmostAccessExpression) ||
((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;
Expand Down
12 changes: 12 additions & 0 deletions tests/cases/fourslash/getJavaScriptCompletions22.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/// <reference path="fourslash.ts" />

// Regresion test for GH#45436

// @allowNonTsExtensions: true
// @Filename: file.js
//// const abc = {};
//// ({./*1*/});

goTo.marker('1');
edit.insert('.');
verify.completions({ exact: undefined });