Skip to content

Conversation

DickvdBrink
Copy link
Contributor

Formatting after the modifier didn't work correctly.
Hope you like it :)

@@ -318,7 +318,7 @@ namespace ts.formatting {
this.NoSpaceAfterModuleImport = new Rule(RuleDescriptor.create2(Shared.TokenRange.FromTokens([SyntaxKind.ModuleKeyword, SyntaxKind.RequireKeyword]), SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));

// Add a space around certain TypeScript keywords
this.SpaceAfterCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.ClassKeyword, SyntaxKind.DeclareKeyword, SyntaxKind.EnumKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ExtendsKeyword, SyntaxKind.GetKeyword, SyntaxKind.ImplementsKeyword, SyntaxKind.ImportKeyword, SyntaxKind.InterfaceKeyword, SyntaxKind.ModuleKeyword, SyntaxKind.NamespaceKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.PublicKeyword, SyntaxKind.SetKeyword, SyntaxKind.StaticKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
this.SpaceAfterCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.ClassKeyword, SyntaxKind.DeclareKeyword, 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]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SyntaxKind.PrivateKeyword, SyntaxKind.PublicKeyword, , SyntaxKind.ProtectedKeyword`
                                                    ^^

There is an implicit undefined in this list.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops sorry, will force-push

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing!

As a side note, for bigger changes, we prefer to keep commits around for the purpose of review history. Clearly it's not an issue here, but thought I'd just bring that up.

@DanielRosenwasser
Copy link
Member

Thanks @DickvdBrink!

DanielRosenwasser added a commit that referenced this pull request Jun 24, 2015
@DanielRosenwasser DanielRosenwasser merged commit 84ff2f8 into microsoft:master Jun 24, 2015
@mhegazy
Copy link
Contributor

mhegazy commented Jun 24, 2015

@aozgaa you will need to add abstract to the list just like @DickvdBrink did, and @rbuckton will need to add async and await as well.

@mhegazy
Copy link
Contributor

mhegazy commented Jun 24, 2015

@DickvdBrink we should add default as well. e.g. export default class Foo {}

@vladima
Copy link
Contributor

vladima commented Jun 24, 2015

@mhegazy formatting for abstract is already included in corresponding PR

@DickvdBrink
Copy link
Contributor Author

Will do later today @mhegazy (with some tests as well :))

@DickvdBrink DickvdBrink deleted the format-protected branch June 25, 2015 18:11
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants