-
Notifications
You must be signed in to change notification settings - Fork 48
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
Text block get formatted uggly #930
Comments
+1000 on improving the formatting of text blocks, for me I find I use var text =
"""
update master_data_manager
set version = version + 1, update_time = now(), update_by = #{userId}
where site_id = %s and table_name = #{tableName}
"""
.formatted("site"); Ideally, the opening var text = """
update master_data_manager
set version = version + 1, update_time = now(), update_by = #{userId}
where site_id = %s and table_name = #{tableName}
""".formatted("site"); would be ideal. |
If memory serves, we don’t currently format text blocks, only the code around them. This is due to their structure being both a string a block which is indention-sensitive. |
@carterkozak From memory, javac automatically strips away the incidental/grey white space (the initial indentation on the first line of the text block), so changing that initial base indentation shouldn't cause any issues - as long as any additional indentation is respected. |
+1 to get something more common/standard and less unlikely by default, formatting should stay well readable after all ;) |
+1, there is a nice overview here: https://docs.oracle.com/en/java/javase/21/text-blocks/index.html#incidental-white-space For what it's worth, the approach google-java-format is currently taking for text blocks is to re-indent them to the current continuation indent (see here). |
@CRogers any chance we can get an update here? |
What happened?
this tool formats text block in not ideal format.
see original verion.
output
What did you want to happen?
keep the same as original.
The text was updated successfully, but these errors were encountered: