-
Notifications
You must be signed in to change notification settings - Fork 14
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
autoformatting: reflow multi-line comments and strings #28
Comments
We now correctly handle the example given above. The current output is: val x =
(* this is a
* multiline comment
* which needs some love
*)
"I wonder where \
\the rest of this string will go?" |
I believe this is now correct as long as every tab in the input is properly aligned. (By "properly aligned", I mean that tabs appear only at multiples of the tab-width. For example with a tab-width of 4, the line What is the effective spacing of a misaligned tab? Maybe we just need to advance to the next aligned position? This seems to be the way VSCode handles it. Same for other editors too? |
I finished this up by advancing to the next tabstop. Tab widths are controllable via |
Currently, the pretty-printer doesn't handle multi-line elements very well. See example below.
This is a little tricky because in the layout algorithm, each text element is assumed to not contain newlines. To fix this, we should probably just do special-case handling of comments and strings, perhaps as a separate pass over a
TokenDoc
.Example of bad formatting
INPUT
OUTPUT
The text was updated successfully, but these errors were encountered: