diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 8ffdef428eb..232411d03d9 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -656,12 +656,10 @@ module FourSlash { } } - public verifyCompletionListIsBuilder(negative: boolean) { + public verifyCompletionListHasBuilder(negative: boolean) { var completions = this.getCompletionListAtCaret(); - if (!completions) { - this.raiseError("Expected completion list"); - } else if ((completions && !completions.isBuilder) && !negative) { + if ((completions && !completions.isBuilder) && !negative) { this.raiseError("Expected builder completion entry"); } else if ((completions && completions.isBuilder) && negative) { this.raiseError("Un-expected builder completion entry"); diff --git a/src/services/services.ts b/src/services/services.ts index 7ebf21abc1d..bbd297a3940 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2376,9 +2376,11 @@ module ts { // variable declarations switch (previousToken.kind) { case SyntaxKind.CommaToken: - return containingNodeKind === SyntaxKind.CallExpression; + return containingNodeKind === SyntaxKind.CallExpression + || containingNodeKind === SyntaxKind.Constructor; case SyntaxKind.OpenParenToken: - return containingNodeKind === SyntaxKind.CallExpression; + return containingNodeKind === SyntaxKind.CallExpression + || containingNodeKind === SyntaxKind.Constructor; case SyntaxKind.ModuleKeyword: return true; case SyntaxKind.DotToken: @@ -2435,7 +2437,6 @@ module ts { case SyntaxKind.FunctionDeclaration: case SyntaxKind.MethodDeclaration: case SyntaxKind.MethodSignature: - case SyntaxKind.Constructor: case SyntaxKind.GetAccessor: case SyntaxKind.SetAccessor: case SyntaxKind.CallSignature: @@ -2482,7 +2483,9 @@ module ts { case SyntaxKind.PrivateKeyword: case SyntaxKind.StaticKeyword: case SyntaxKind.DotDotDotToken: - return containingNodeKind === SyntaxKind.Parameter || containingNodeKind === SyntaxKind.PropertyDeclaration; + return containingNodeKind === SyntaxKind.Parameter + || containingNodeKind === SyntaxKind.PropertyDeclaration + || containingNodeKind === SyntaxKind.Constructor; case SyntaxKind.ClassKeyword: case SyntaxKind.EnumKeyword: diff --git a/tests/cases/fourslash/completionListAtIdentifierDefinitionLocations_parameters.ts b/tests/cases/fourslash/completionListAtIdentifierDefinitionLocations_parameters.ts index 0fd66e9d091..f5a82cdcc57 100644 --- a/tests/cases/fourslash/completionListAtIdentifierDefinitionLocations_parameters.ts +++ b/tests/cases/fourslash/completionListAtIdentifierDefinitionLocations_parameters.ts @@ -10,26 +10,19 @@ ////function testFunction(a, b/*parameterName4*/ -////class bar1{ constructor(/*constructorParamter1*/ +////class bar5{ constructor(public /*constructorParamter1*/ -////class bar2{ constructor(a/*constructorParamter2*/ +////class bar6{ constructor(public a/*constructorParamter2*/ -////class bar3{ constructor(a, /*constructorParamter3*/ +////class bar7{ constructor(private a/*constructorParamter3*/ -////class bar4{ constructor(a, b/*constructorParamter4*/ +////class bar8{ constructor(.../*constructorParamter4*/ -////class bar5{ constructor(public /*constructorParamter5*/ - -////class bar6{ constructor(public a/*constructorParamter6*/ - -////class bar7{ constructor(private a/*constructorParamter7*/ - -////class bar8{ constructor(.../*constructorParamter8*/ - -////class bar9{ constructor(...a/*constructorParamter9*/ +////class bar9{ constructor(...a/*constructorParamter5*/ test.markers().forEach((m) => { goTo.position(m.position, m.fileName); verify.completionListIsEmpty(); + verify.not.completionListIsBuilder(); }); diff --git a/tests/cases/fourslash/completionListBuilderLocations_Modules.ts b/tests/cases/fourslash/completionListBuilderLocations_Modules.ts index a629371d147..d39c52318ce 100644 --- a/tests/cases/fourslash/completionListBuilderLocations_Modules.ts +++ b/tests/cases/fourslash/completionListBuilderLocations_Modules.ts @@ -9,6 +9,5 @@ test.markers().forEach((m) => { goTo.position(m.position, m.fileName); verify.not.completionListIsEmpty(); - debugger; verify.completionListIsBuilder(); }); \ No newline at end of file diff --git a/tests/cases/fourslash/fourslash.ts b/tests/cases/fourslash/fourslash.ts index 243629fa347..71e3d723e20 100644 --- a/tests/cases/fourslash/fourslash.ts +++ b/tests/cases/fourslash/fourslash.ts @@ -173,7 +173,7 @@ module FourSlashInterface { } public completionListIsBuilder() { - FourSlash.currentTestState.verifyCompletionListIsBuilder(this.negative); + FourSlash.currentTestState.verifyCompletionListHasBuilder(this.negative); } public memberListIsEmpty() {