-
Notifications
You must be signed in to change notification settings - Fork 456
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
indent step not playing nicely with multiline string literals #1628
Comments
It even reformats the code with |
Any workarounds appreciated! |
It looks like the "source" and "reformatted" that you copy-pasted above are the same. Is that a mistake? Regardless, I would try commenting out a step until you know exactly which step is causing this issue. I would guess it is palantir. Then I would file an issue in their bugtracker.
For sure you can workaround this bug with spotless:off. Do you have a tag |
Hey! No it's different, see the text block! It modified the Text block. Look closely. Yes, I tried and it's NOT palantir. Only if I add the indent steps. Oh, and yes, I had both comments in there and it didn't work. Will try to set to a demo project on the train tomorrow. |
Ahhh, I see it now. You are correct, this is a problem in our indent step.
We're turning every 4 spaces into a tab, and then turning each tab into 2 spaces. The indent step just looks for leading spaces, it doesn't (currently) know anything about the syntax of multiline string literals on the various languages it is used for. So the first line, indented by 2 spaces, which is not a multiple of 4, it makes sense that it gets clobbered. But I would expect the second line to be okay. We picked bad names for these steps, and we should fix that in our next breaking version change And regardless of that,
|
100% agree! For now, the quickest and easiest solution would probably be to get the off working. I'm traveling right now, so I'm terribly sorry I wasn't able to upload a reproducer. |
@nedtwigg are we still waiting for palantir/palantir-java-format#930 ? |
@bmarwell thanks for the duplicate tag, any way forward on this topic? |
If you are submitting a bug, please include the following:
gradlew spotless[Apply/Check] --stacktrace
setup
Maven any 3.8.x
spotless 2.32.0
OS - Mac, Linux, windows
What happened?
Reformats and destroys text blocks
source:
reformatted:
Config:
spotless + indent 4 tabs + then indent 2 spaces (recommended workaround by spotless to have palantir with two spaces)
What did you want to happen?
Maybe nudge the text block to the right, but the difference between the closing
"""
and the text MAY NOT BE ALTERED!The text was updated successfully, but these errors were encountered: