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
Support brackets in multiline strings #2995
Conversation
@Giggiux I think that result type of |
3435af9
to
12674b1
Compare
So the value used to "go to the next formatter" would become |
I mentioned |
I think one example in which we want to stop the formatting is for example when we're in a MultilineString and we try to format the range of the multiline string, but it's already formatted. In that case, we may want to stop there, because the "indent on paste" formatter would handle the multiline string format in a different way (as if the multi-lines strings were "normal" code, not a continuation of the previous string). You are right, in this case Of course, we could use as alternatives This is obviously just my opinion, and there is plenty of people in the collaborator's team that is way more experienced that me in taking this kind of decision, so probably it would be better to ping them too 😂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work!
Thx for taking this issue. That was a really annoying behavior.
I left some questions/suggestions
metals/src/main/scala/scala/meta/internal/metals/formatting/MultilineString.scala
Outdated
Show resolved
Hide resolved
metals/src/main/scala/scala/meta/internal/metals/formatting/MultilineString.scala
Outdated
Show resolved
Hide resolved
metals/src/main/scala/scala/meta/internal/metals/formatting/MultilineString.scala
Outdated
Show resolved
Hide resolved
metals/src/main/scala/scala/meta/internal/metals/formatting/MultilineString.scala
Outdated
Show resolved
Hide resolved
metals/src/main/scala/scala/meta/internal/metals/formatting/MultilineString.scala
Outdated
Show resolved
Hide resolved
@Giggiux I understand your point of view, it totally makes sense so we should leave it as it is. Thanks for such an exhausting answer! ;) |
Refactored and simplified MultilineString.scala Properly indent brackets in multiline string Fix nested interpolations issues with stripMargin Fix failing test on windows Review fixes Scalafix fix
0dbb4a9
to
7dc0fd1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Fixes #2502
Previously, newlines inserted by the editor (vscode) were misplacing brackets.
Now, after changes, brackets are indented correctly:
Edit
Second commit fixes #2983