From 63f3bafed685b5d0f723e75559da07bd530aece9 Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Thu, 30 Apr 2015 15:41:14 -0700 Subject: [PATCH] Fixes Aggressive completion makes it difficult to type function types. #2494 + test case --- src/services/services.ts | 4 +++- ...completionListNewIdentifierFunctionDeclaration.ts | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/completionListNewIdentifierFunctionDeclaration.ts diff --git a/src/services/services.ts b/src/services/services.ts index 06da4859274..7af601c7e30 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2986,7 +2986,9 @@ module ts { return containingNodeKind === SyntaxKind.CallExpression // func( | || containingNodeKind === SyntaxKind.Constructor // constructor( | || containingNodeKind === SyntaxKind.NewExpression // new C(a| - || containingNodeKind === SyntaxKind.ParenthesizedExpression; // let x = (a| + || containingNodeKind === SyntaxKind.ParenthesizedExpression // let x = (a| + || containingNodeKind === SyntaxKind.ParenthesizedType // function F(pred: (a| + || containingNodeKind === SyntaxKind.Parameter; // function F(pred: a| case SyntaxKind.OpenBracketToken: return containingNodeKind === SyntaxKind.ArrayLiteralExpression; // [ | diff --git a/tests/cases/fourslash/completionListNewIdentifierFunctionDeclaration.ts b/tests/cases/fourslash/completionListNewIdentifierFunctionDeclaration.ts new file mode 100644 index 00000000000..3180f8fd820 --- /dev/null +++ b/tests/cases/fourslash/completionListNewIdentifierFunctionDeclaration.ts @@ -0,0 +1,12 @@ +/// + +////function F(pref: (a/*1*/ +//// +////function F(pref: a/*2*/ +//// + +test.markers().forEach((m) => { + goTo.position(m.position, m.fileName); + verify.not.completionListIsEmpty(); + verify.completionListAllowsNewIdentifier(); +});