@@ -87,6 +87,7 @@ namespace ts.formatting {
8787 public SpaceAfterLetConstInVariableDeclaration : Rule ;
8888 public NoSpaceBeforeOpenParenInFuncCall : Rule ;
8989 public SpaceAfterFunctionInFuncDecl : Rule ;
90+ public SpaceBeforeOpenParenInFuncDecl : Rule ;
9091 public NoSpaceBeforeOpenParenInFuncDecl : Rule ;
9192 public SpaceAfterVoidOperator : Rule ;
9293
@@ -112,6 +113,7 @@ namespace ts.formatting {
112113 // TypeScript-specific rules
113114
114115 // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses
116+ public SpaceAfterConstructor : Rule ;
115117 public NoSpaceAfterConstructor : Rule ;
116118
117119 // Use of module as a function call. e.g.: import m2 = module("m2");
@@ -329,6 +331,7 @@ namespace ts.formatting {
329331 this . SpaceAfterLetConstInVariableDeclaration = new Rule ( RuleDescriptor . create4 ( Shared . TokenRange . FromTokens ( [ SyntaxKind . LetKeyword , SyntaxKind . ConstKeyword ] ) , Shared . TokenRange . Any ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsNonJsxSameLineTokenContext , Rules . IsStartOfVariableDeclarationList ) , RuleAction . Space ) ) ;
330332 this . NoSpaceBeforeOpenParenInFuncCall = new Rule ( RuleDescriptor . create2 ( Shared . TokenRange . Any , SyntaxKind . OpenParenToken ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsNonJsxSameLineTokenContext , Rules . IsFunctionCallOrNewContext , Rules . IsPreviousTokenNotComma ) , RuleAction . Delete ) ) ;
331333 this . SpaceAfterFunctionInFuncDecl = new Rule ( RuleDescriptor . create3 ( SyntaxKind . FunctionKeyword , Shared . TokenRange . Any ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsFunctionDeclContext ) , RuleAction . Space ) ) ;
334+ this . SpaceBeforeOpenParenInFuncDecl = new Rule ( RuleDescriptor . create2 ( Shared . TokenRange . Any , SyntaxKind . OpenParenToken ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsNonJsxSameLineTokenContext , Rules . IsFunctionDeclContext ) , RuleAction . Space ) ) ;
332335 this . NoSpaceBeforeOpenParenInFuncDecl = new Rule ( RuleDescriptor . create2 ( Shared . TokenRange . Any , SyntaxKind . OpenParenToken ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsNonJsxSameLineTokenContext , Rules . IsFunctionDeclContext ) , RuleAction . Delete ) ) ;
333336 this . SpaceAfterVoidOperator = new Rule ( RuleDescriptor . create3 ( SyntaxKind . VoidKeyword , Shared . TokenRange . Any ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsNonJsxSameLineTokenContext , Rules . IsVoidOpContext ) , RuleAction . Space ) ) ;
334337
@@ -352,6 +355,7 @@ namespace ts.formatting {
352355 // TypeScript-specific higher priority rules
353356
354357 // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses
358+ this . SpaceAfterConstructor = new Rule ( RuleDescriptor . create1 ( SyntaxKind . ConstructorKeyword , SyntaxKind . OpenParenToken ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsNonJsxSameLineTokenContext ) , RuleAction . Space ) ) ;
355359 this . NoSpaceAfterConstructor = new Rule ( RuleDescriptor . create1 ( SyntaxKind . ConstructorKeyword , SyntaxKind . OpenParenToken ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsNonJsxSameLineTokenContext ) , RuleAction . Delete ) ) ;
356360
357361 // Use of module as a function call. e.g.: import m2 = module("m2");
@@ -437,7 +441,7 @@ namespace ts.formatting {
437441 this . NoSpaceBeforeEqualInJsxAttribute , this . NoSpaceAfterEqualInJsxAttribute ,
438442
439443 // TypeScript-specific rules
440- this . NoSpaceAfterConstructor , this . NoSpaceAfterModuleImport ,
444+ this . NoSpaceAfterModuleImport ,
441445 this . SpaceAfterCertainTypeScriptKeywords , this . SpaceBeforeCertainTypeScriptKeywords ,
442446 this . SpaceAfterModuleName ,
443447 this . SpaceBeforeArrow , this . SpaceAfterArrow ,
@@ -462,7 +466,6 @@ namespace ts.formatting {
462466 this . NoSpaceBeforeOpenBracket ,
463467 this . NoSpaceAfterCloseBracket ,
464468 this . SpaceAfterSemicolon ,
465- this . NoSpaceBeforeOpenParenInFuncDecl ,
466469 this . SpaceBetweenStatements , this . SpaceAfterTryFinally
467470 ] ;
468471
0 commit comments