mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
fix(38840): omit completions for a spread like argument in a function definition (#38897)
This commit is contained in:
parent
59f80970d9
commit
95690c0aca
@ -962,12 +962,13 @@ namespace ts.Completions {
|
||||
case SyntaxKind.PropertyAccessExpression:
|
||||
propertyAccessToConvert = parent as PropertyAccessExpression;
|
||||
node = propertyAccessToConvert.expression;
|
||||
if (node.end === contextToken.pos &&
|
||||
isCallExpression(node) &&
|
||||
if ((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 call expression and user is starting to write spread
|
||||
// This is likely dot from incorrectly parsed expression and user is starting to write spread
|
||||
// eg: Math.min(./**/)
|
||||
// const x = function (./**/) {}
|
||||
return undefined;
|
||||
}
|
||||
break;
|
||||
|
||||
33
tests/cases/fourslash/completionWritingSpreadLikeArgument.ts
Normal file
33
tests/cases/fourslash/completionWritingSpreadLikeArgument.ts
Normal file
@ -0,0 +1,33 @@
|
||||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////const t0 = {
|
||||
//// x: function (./*0*/) {}
|
||||
////}
|
||||
////const t1 = {
|
||||
//// x: (./*1*/) => {}
|
||||
////}
|
||||
////const t2 = {
|
||||
//// x: function foo(./*2*/) => {}
|
||||
////}
|
||||
////const t3 = {
|
||||
//// x(./*3*/) {}
|
||||
////}
|
||||
////
|
||||
////const t4 = function (./*4*/) {}
|
||||
////const t5 = (./*5*/) => {}
|
||||
////function t6(./*6*/) {}
|
||||
////
|
||||
////class Foo {
|
||||
//// m(./*7*/) {}
|
||||
////}
|
||||
|
||||
for (const marker of test.markers()) {
|
||||
goTo.marker(marker);
|
||||
verify.completions({ exact: undefined });
|
||||
|
||||
edit.insert(".");
|
||||
verify.completions({ exact: undefined });
|
||||
|
||||
edit.insert(".");
|
||||
verify.completions({ exact: undefined });
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user