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

ConditionalExpression indentation #83

Closed
belav opened this issue Apr 11, 2021 · 0 comments · Fixed by #362
Closed

ConditionalExpression indentation #83

belav opened this issue Apr 11, 2021 · 0 comments · Fixed by #362
Milestone

Comments

@belav
Copy link
Owner

belav commented Apr 11, 2021

The changes for #76 seem to indent too much in some real world code.

// new version
            Doc sections = node.Sections.Count == 0
                ? " "
                : Docs.Concat(
                        Docs.Indent(
                            Docs.Concat(
                                Docs.HardLine,
                                Join(
                                    Docs.HardLine,
                                    node.Sections.Select(this.Print)
                                )
                            )
                        ),
                        Docs.HardLine
                    );
// old version
            Doc sections = node.Sections.Count == 0
                ? " "
                : Docs.Concat(
                    Docs.Indent(
                        Docs.Concat(
                            Docs.HardLine,
                            Join(
                                Docs.HardLine,
                                node.Sections.Select(this.Print)
                            )
                        )
                    ),
                    Docs.HardLine
                );

prettier appears to use the align doc type for this, to keep from adding too much extra indentation along with a whole lot of other logic for what to do.

@belav belav added this to the Beta milestone Apr 11, 2021
@belav belav removed the regression label May 5, 2021
@belav belav removed this from the Beta milestone Jun 14, 2021
@belav belav added this to the 0.9.8 milestone Jul 19, 2021
belav added a commit that referenced this issue Jul 19, 2021
shocklateboy92 pushed a commit that referenced this issue Jul 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant