@@ -264,7 +264,7 @@ namespace ts.formatting {
264264 this . SpaceBeforeOpenBraceInFunction = new Rule ( RuleDescriptor . create2 ( this . FunctionOpenBraceLeftTokenRange , SyntaxKind . OpenBraceToken ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsFunctionDeclContext , Rules . IsBeforeBlockContext , Rules . IsNotFormatOnEnter , Rules . IsSameLineTokenOrBeforeMultilineBlockContext ) , RuleAction . Space ) , RuleFlags . CanDeleteNewLines ) ;
265265
266266 // Place a space before open brace in a TypeScript declaration that has braces as children (class, module, enum, etc)
267- this . TypeScriptOpenBraceLeftTokenRange = Shared . TokenRange . FromTokens ( [ SyntaxKind . Identifier , SyntaxKind . MultiLineCommentTrivia , SyntaxKind . ClassKeyword ] ) ;
267+ this . TypeScriptOpenBraceLeftTokenRange = Shared . TokenRange . FromTokens ( [ SyntaxKind . Identifier , SyntaxKind . MultiLineCommentTrivia , SyntaxKind . ClassKeyword , SyntaxKind . ExportKeyword , SyntaxKind . ImportKeyword ] ) ;
268268 this . SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new Rule ( RuleDescriptor . create2 ( this . TypeScriptOpenBraceLeftTokenRange , SyntaxKind . OpenBraceToken ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsTypeScriptDeclWithBlockContext , Rules . IsNotFormatOnEnter , Rules . IsSameLineTokenOrBeforeMultilineBlockContext ) , RuleAction . Space ) , RuleFlags . CanDeleteNewLines ) ;
269269
270270 // Place a space before open brace in a control flow construct
@@ -338,8 +338,8 @@ namespace ts.formatting {
338338 this . NoSpaceAfterModuleImport = new Rule ( RuleDescriptor . create2 ( Shared . TokenRange . FromTokens ( [ SyntaxKind . ModuleKeyword , SyntaxKind . RequireKeyword ] ) , SyntaxKind . OpenParenToken ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsNonJsxSameLineTokenContext ) , RuleAction . Delete ) ) ;
339339
340340 // Add a space around certain TypeScript keywords
341- this . SpaceAfterCertainTypeScriptKeywords = new Rule ( RuleDescriptor . create4 ( Shared . TokenRange . FromTokens ( [ SyntaxKind . AbstractKeyword , SyntaxKind . ClassKeyword , SyntaxKind . DeclareKeyword , SyntaxKind . DefaultKeyword , SyntaxKind . EnumKeyword , SyntaxKind . ExportKeyword , SyntaxKind . ExtendsKeyword , SyntaxKind . GetKeyword , SyntaxKind . ImplementsKeyword , SyntaxKind . ImportKeyword , SyntaxKind . InterfaceKeyword , SyntaxKind . ModuleKeyword , SyntaxKind . NamespaceKeyword , SyntaxKind . PrivateKeyword , SyntaxKind . PublicKeyword , SyntaxKind . ProtectedKeyword , SyntaxKind . SetKeyword , SyntaxKind . StaticKeyword , SyntaxKind . TypeKeyword ] ) , Shared . TokenRange . Any ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsNonJsxSameLineTokenContext ) , RuleAction . Space ) ) ;
342- this . SpaceBeforeCertainTypeScriptKeywords = new Rule ( RuleDescriptor . create4 ( Shared . TokenRange . Any , Shared . TokenRange . FromTokens ( [ SyntaxKind . ExtendsKeyword , SyntaxKind . ImplementsKeyword ] ) ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsNonJsxSameLineTokenContext ) , RuleAction . Space ) ) ;
341+ this . SpaceAfterCertainTypeScriptKeywords = new Rule ( RuleDescriptor . create4 ( Shared . TokenRange . FromTokens ( [ SyntaxKind . AbstractKeyword , SyntaxKind . ClassKeyword , SyntaxKind . DeclareKeyword , SyntaxKind . DefaultKeyword , SyntaxKind . EnumKeyword , SyntaxKind . ExportKeyword , SyntaxKind . ExtendsKeyword , SyntaxKind . GetKeyword , SyntaxKind . ImplementsKeyword , SyntaxKind . ImportKeyword , SyntaxKind . InterfaceKeyword , SyntaxKind . ModuleKeyword , SyntaxKind . NamespaceKeyword , SyntaxKind . PrivateKeyword , SyntaxKind . PublicKeyword , SyntaxKind . ProtectedKeyword , SyntaxKind . SetKeyword , SyntaxKind . StaticKeyword , SyntaxKind . TypeKeyword , SyntaxKind . FromKeyword ] ) , Shared . TokenRange . Any ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsNonJsxSameLineTokenContext ) , RuleAction . Space ) ) ;
342+ this . SpaceBeforeCertainTypeScriptKeywords = new Rule ( RuleDescriptor . create4 ( Shared . TokenRange . Any , Shared . TokenRange . FromTokens ( [ SyntaxKind . ExtendsKeyword , SyntaxKind . ImplementsKeyword , SyntaxKind . FromKeyword ] ) ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsNonJsxSameLineTokenContext ) , RuleAction . Space ) ) ;
343343
344344 // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" {
345345 this . SpaceAfterModuleName = new Rule ( RuleDescriptor . create1 ( SyntaxKind . StringLiteral , SyntaxKind . OpenBraceToken ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsModuleDeclContext ) , RuleAction . Space ) ) ;
@@ -514,6 +514,8 @@ namespace ts.formatting {
514514 case SyntaxKind . BinaryExpression :
515515 case SyntaxKind . ConditionalExpression :
516516 case SyntaxKind . AsExpression :
517+ case SyntaxKind . ExportSpecifier :
518+ case SyntaxKind . ImportSpecifier :
517519 case SyntaxKind . TypePredicate :
518520 case SyntaxKind . UnionType :
519521 case SyntaxKind . IntersectionType :
@@ -650,6 +652,10 @@ namespace ts.formatting {
650652 case SyntaxKind . EnumDeclaration :
651653 case SyntaxKind . TypeLiteral :
652654 case SyntaxKind . ModuleDeclaration :
655+ case SyntaxKind . ExportDeclaration :
656+ case SyntaxKind . NamedExports :
657+ case SyntaxKind . ImportDeclaration :
658+ case SyntaxKind . NamedImports :
653659 return true ;
654660 }
655661
0 commit comments