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

Fix indentation after comment inside 'when' #5655

Conversation

makenowjust
Copy link
Contributor

Fix #5654

@asterite asterite added this to the Next milestone Jan 29, 2018
@asterite asterite merged commit 995d3f9 into crystal-lang:master Jan 29, 2018
@RX14
Copy link
Contributor

RX14 commented Jan 29, 2018

It still bugs me that all these formatter test cases are unreadable.

In my opinion all the formatter test cases should be in a bunch of annotated, parsed, .cr files, with one file per test and then you can actually see the indenting instead of working it out in your head by counting around \n characters. Or at the least they should use heredocs.

@asterite
Copy link
Member

We can probably copy what the guys over at rufo ended up doing: https://github.com/ruby-formatter/rufo/blob/master/spec/lib/rufo/formatter_source_specs/align_chained_calls.rb.spec

@asterite
Copy link
Member

Another issue is that this "newline check comment" appears many times in the formatter. When I did rufo I made sure this logic was done only once (or as few times as possible)... but of course I had the knowledge of this formatter to begin with. The formatter, as all other pieces, probably need a good refactoring/rewrite.

@RX14
Copy link
Contributor

RX14 commented Jan 29, 2018

@asterite yeah that's pretty much what I intended.

@makenowjust makenowjust deleted the fix/crystal-format/keep-indent-in-when-comma branch January 30, 2018 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants