Expose indentation suppressor from SmartIndenter#4757
Merged
mhegazy merged 12 commits intomicrosoft:masterfrom Dec 9, 2015
Merged
Expose indentation suppressor from SmartIndenter#4757mhegazy merged 12 commits intomicrosoft:masterfrom
mhegazy merged 12 commits intomicrosoft:masterfrom
Conversation
This was referenced Sep 12, 2015
Member
There was a problem hiding this comment.
Use undefined, not null
Member
|
Ping @vladima |
Contributor
There was a problem hiding this comment.
to me condition SI.shouldInheritParentIndentation() ? 0 : delta look more clear and it is doing the same thing.
- if delta is not-null-or-zero then body of
getDeltaboils down toSI.shouldInheritParentIndentation() ? 0 : delta - if delta zero then
getDeltaevaluates to justdeltawhich will mean the same
Contributor
Author
There was a problem hiding this comment.
You're right, it's doing the same thing. I was to pass the SI check when delta value is already zero but I agree that it looks less clear. Do you want me to fix this?
Member
There was a problem hiding this comment.
remove parens around child
saschanaz
added a commit
to saschanaz/TypeScript
that referenced
this pull request
Dec 3, 2015
This was referenced Dec 3, 2015
Contributor
|
sorry for the delay. Can you add the @internal annotation in your next PR. |
mhegazy
added a commit
that referenced
this pull request
Dec 9, 2015
Expose indentation suppressor from SmartIndenter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Separated from #4609.
shouldIndentChildNodefunction already have indentation suppressing feature, but currently auto-formatter disables it to get delta value and implements another suppressor incomputeIndentationfunction.This PR split the suppressor from
shouldIndentChildNodeand expose it as a separate function so that formatter can use it without implementing its own one.The function will help suppress indentation of:
ImportClausenode inImportDeclarationnode. (Fix named export/import formatting #4609)JsxClosingElementnode. (Fixing JSX/TSX closing tag/attribute/expression formatting #4398)Note:
shouldInheritParentIndentationand its internalnodeWillIndentChildreceives TextRangeWithKind to check more conditions other than syntax kind.