Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistently indent by 4 spaces (or by tabs) #623

Merged
merged 14 commits into from
May 9, 2022
Merged

Consistently indent by 4 spaces (or by tabs) #623

merged 14 commits into from
May 9, 2022

Conversation

belav
Copy link
Owner

@belav belav commented Feb 26, 2022

closes #617

@belav belav changed the title basic ditch align2 Seeing what conforming to indent = 4 would look like Feb 26, 2022
@belav belav force-pushed the ditch-align2 branch 2 times, most recently from ab8f7dd to c5c73c3 Compare April 25, 2022 21:25
@belav belav changed the title Seeing what conforming to indent = 4 would look like Consistently indent by 4 spaces (or by tabs) Apr 25, 2022
@belav belav marked this pull request as ready for review May 2, 2022 16:19
return Doc.Group(
Doc.Indent(groupId != null ? Doc.IfBreak(" ", prefix, groupId) : prefix),
groupId != null
? Doc.IfBreak(Doc.Align(2, body), Doc.Indent(body), groupId)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Heh, funny we never extracted the 2 to a constant. I was kind of hoping this change (on the code side) would be a simple HalfIndent = DefaultIndent 😏

|| node.Parent is ConditionalExpressionSyntax
&& node.Parent.Parent is not ArgumentSyntax;
|| (
node.Parent is ConditionalExpressionSyntax conditionalExpressionSyntax
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you could have done some fancy pattern matching shenanigans like:

node.Parent is ConditionalExpressionSyntax
{ 
    WhenTrue: not node,
    WhenFalse: not node
}

Though, I don't know if it will allow node as the target or if it needs to be a literal value.

Copy link
Owner Author

Choose a reason for hiding this comment

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

I just tried it out, it does require a constant value

@belav belav merged commit 045bc59 into master May 9, 2022
@belav belav deleted the ditch-align2 branch May 9, 2022 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consistently Indent By 4 Spaces
2 participants