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

Indentation of pretty-printed blocks is terrible #904

Closed
marijnh opened this issue Sep 12, 2011 · 4 comments
Closed

Indentation of pretty-printed blocks is terrible #904

marijnh opened this issue Sep 12, 2011 · 4 comments
Labels
A-pretty Area: Pretty printing (including `-Z unpretty`)

Comments

@marijnh
Copy link
Contributor

marijnh commented Sep 12, 2011

It indents the body deeper than the opening brace, and runs off the right margin. I think something like this would preferable:

callsomethingwithablock({ | x | {
    // Indent one unit beyond the line that opened the block
    body_here();
});
@marijnh
Copy link
Contributor Author

marijnh commented Sep 12, 2011

Same for other function expressions, actually. Unfortunately, the current pretty-printer isn't really suited for 'javascript-style' indentation.

@graydon
Copy link
Contributor

graydon commented Feb 14, 2012

Does the "better" notation of foo() { | ... | } prints less horribly?

@marijnh
Copy link
Contributor Author

marijnh commented Feb 14, 2012

I haven't tried. But even if it does, blocks-within-parenthesis are a part of the language and should be handled in a moderately elegant way.

@ghost ghost assigned catamorphism Mar 15, 2012
@brson
Copy link
Contributor

brson commented Aug 13, 2012

Block syntax is different now. It still doesn't pretty-print that nicely, but it is broken in different ways.

@brson brson closed this as completed Aug 13, 2012
coastalwhite pushed a commit to coastalwhite/rust that referenced this issue Aug 5, 2023
The implementation is the same (where possible), and it unblocks rust-lang#904

Signed-off-by: Joe Richey <[email protected]>
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
* use message-format plain, update error handling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-pretty Area: Pretty printing (including `-Z unpretty`)
Projects
None yet
Development

No branches or pull requests

4 participants