@@ -123,6 +123,7 @@ namespace ts.formatting {
123
123
public SpaceAfterModuleName : Rule ;
124
124
125
125
// Lambda expressions
126
+ public SpaceBeforeArrow : Rule ;
126
127
public SpaceAfterArrow : Rule ;
127
128
128
129
// Optional parameters and let args
@@ -254,7 +255,7 @@ namespace ts.formatting {
254
255
255
256
// No space before and after indexer
256
257
this . NoSpaceBeforeOpenBracket = new Rule ( RuleDescriptor . create2 ( Shared . TokenRange . Any , SyntaxKind . OpenBracketToken ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsSameLineTokenContext ) , RuleAction . Delete ) ) ;
257
- this . NoSpaceAfterCloseBracket = new Rule ( RuleDescriptor . create3 ( SyntaxKind . CloseBracketToken , Shared . TokenRange . Any ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsSameLineTokenContext , Rules . IsNotBeforeBlockInFunctionDeclarationContext ) , RuleAction . Delete ) ) ;
258
+ this . NoSpaceAfterCloseBracket = new Rule ( RuleDescriptor . create3 ( SyntaxKind . CloseBracketToken , Shared . TokenRange . Any ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsSameLineTokenContext , Rules . IsNotBeforeBlockInFunctionDeclarationContext ) , RuleAction . Delete ) ) ;
258
259
259
260
// Place a space before open brace in a function declaration
260
261
this . FunctionOpenBraceLeftTokenRange = Shared . TokenRange . AnyIncludingMultilineComments ;
@@ -342,6 +343,7 @@ namespace ts.formatting {
342
343
this . SpaceAfterModuleName = new Rule ( RuleDescriptor . create1 ( SyntaxKind . StringLiteral , SyntaxKind . OpenBraceToken ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsModuleDeclContext ) , RuleAction . Space ) ) ;
343
344
344
345
// Lambda expressions
346
+ this . SpaceBeforeArrow = new Rule ( RuleDescriptor . create2 ( Shared . TokenRange . Any , SyntaxKind . EqualsGreaterThanToken ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsSameLineTokenContext ) , RuleAction . Space ) ) ;
345
347
this . SpaceAfterArrow = new Rule ( RuleDescriptor . create3 ( SyntaxKind . EqualsGreaterThanToken , Shared . TokenRange . Any ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsSameLineTokenContext ) , RuleAction . Space ) ) ;
346
348
347
349
// Optional parameters and let args
@@ -379,8 +381,7 @@ namespace ts.formatting {
379
381
this . NoSpaceBeforeTemplateMiddleAndTail = new Rule ( RuleDescriptor . create4 ( Shared . TokenRange . Any , Shared . TokenRange . FromTokens ( [ SyntaxKind . TemplateMiddle , SyntaxKind . TemplateTail ] ) ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsSameLineTokenContext ) , RuleAction . Delete ) ) ;
380
382
381
383
// These rules are higher in priority than user-configurable rules.
382
- this . HighPriorityCommonRules =
383
- [
384
+ this . HighPriorityCommonRules = [
384
385
this . IgnoreBeforeComment , this . IgnoreAfterLineComment ,
385
386
this . NoSpaceBeforeColon , this . SpaceAfterColon , this . NoSpaceBeforeQuestionMark , this . SpaceAfterQuestionMarkInConditionalOperator ,
386
387
this . NoSpaceAfterQuestionMark ,
@@ -411,7 +412,7 @@ namespace ts.formatting {
411
412
this . NoSpaceAfterConstructor , this . NoSpaceAfterModuleImport ,
412
413
this . SpaceAfterCertainTypeScriptKeywords , this . SpaceBeforeCertainTypeScriptKeywords ,
413
414
this . SpaceAfterModuleName ,
414
- this . SpaceAfterArrow ,
415
+ this . SpaceBeforeArrow , this . SpaceAfterArrow ,
415
416
this . NoSpaceAfterEllipsis ,
416
417
this . NoSpaceAfterOptionalParameters ,
417
418
this . NoSpaceBetweenEmptyInterfaceBraceBrackets ,
@@ -427,8 +428,7 @@ namespace ts.formatting {
427
428
] ;
428
429
429
430
// These rules are lower in priority than user-configurable rules.
430
- this . LowPriorityCommonRules =
431
- [
431
+ this . LowPriorityCommonRules = [
432
432
this . NoSpaceBeforeSemicolon ,
433
433
this . SpaceBeforeOpenBraceInControl , this . SpaceBeforeOpenBraceInFunction , this . SpaceBeforeOpenBraceInTypeScriptDeclWithBlock ,
434
434
this . NoSpaceBeforeComma ,
@@ -732,7 +732,7 @@ namespace ts.formatting {
732
732
}
733
733
734
734
static IsStartOfVariableDeclarationList ( context : FormattingContext ) : boolean {
735
- return context . currentTokenParent . kind === SyntaxKind . VariableDeclarationList &&
735
+ return context . currentTokenParent . kind === SyntaxKind . VariableDeclarationList &&
736
736
context . currentTokenParent . getStart ( context . sourceFile ) === context . currentTokenSpan . pos ;
737
737
}
738
738
0 commit comments