Skip to content

Commit 782c09d

Browse files
TypeScript Botarmanio123
andauthored
Cherry-pick PR #45484 into release-4.4 (#45564)
Component commits: 33829fa Fix and updated tests 2249d6c Added test e1a2b9e Revert "Fix and updated tests" This reverts commit 33829fa. 51881c4 Filter out empty access expression 2253da6 PR feedback Co-authored-by: Armando Aguirre <armanio123@outlook.com>
1 parent 9eb689e commit 782c09d

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

src/services/completions.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,13 +1338,16 @@ namespace ts.Completions {
13381338
case SyntaxKind.PropertyAccessExpression:
13391339
propertyAccessToConvert = parent as PropertyAccessExpression;
13401340
node = propertyAccessToConvert.expression;
1341-
if ((isCallExpression(node) || isFunctionLike(node)) &&
1342-
node.end === contextToken.pos &&
1343-
node.getChildCount(sourceFile) &&
1344-
last(node.getChildren(sourceFile)).kind !== SyntaxKind.CloseParenToken) {
1341+
const leftmostAccessExpression = getLeftmostAccessExpression(propertyAccessToConvert);
1342+
if (nodeIsMissing(leftmostAccessExpression) ||
1343+
((isCallExpression(node) || isFunctionLike(node)) &&
1344+
node.end === contextToken.pos &&
1345+
node.getChildCount(sourceFile) &&
1346+
last(node.getChildren(sourceFile)).kind !== SyntaxKind.CloseParenToken)) {
13451347
// This is likely dot from incorrectly parsed expression and user is starting to write spread
13461348
// eg: Math.min(./**/)
13471349
// const x = function (./**/) {}
1350+
// ({./**/})
13481351
return undefined;
13491352
}
13501353
break;
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+
// Regresion test for GH#45436
4+
5+
// @allowNonTsExtensions: true
6+
// @Filename: file.js
7+
//// const abc = {};
8+
//// ({./*1*/});
9+
10+
goTo.marker('1');
11+
edit.insert('.');
12+
verify.completions({ exact: undefined });

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy