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
Type interfaces always format to a single line no matter the length. #226
Comments
Strange how this wasn't picked up in a test. I'll take a look tonight and see |
I can't reproduce the issue you are describing. |
It might be my config's |
That's definitely the issue here! The difference between tables and types (currently) is that in tables we implement an extra heuristic where if there is a newline between the opening brace and the first field, we will always expand multi line, regardless of column width. https://prettier.io/docs/en/rationale.html#multi-line-objects may provide a better explanation, but this is what we do too. I could also migrate this to table types as well, so that they will always remain multi line. The only thing I don't like about it is the formatting reversibility, but that's also an issue for tables and it may make sense to make the formatting consistent between the two. |
I very much like it using the carriage-return after the first opening context token ('{' in the table case) being used so it always formats multi-line (even if not bumping against the column budget). if that logic was more consistent (re-used code, even) across if/while/{/(, in both Lua and in types, that would be fantastic. The fact it's not consistent, and needs deep explanation when someone notices this discrepancies, is definitely an impediment to broader adoption in the teams I work with. |
This was nothing like the behavior before. No matter the length of the contents of a type interface, it always shrinks down to a single line.
This completely destroys readability if the interface is super long like the exaggerated example shown before.
The text was updated successfully, but these errors were encountered: