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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multi-line range formatting when on first line #1245

Merged
merged 1 commit into from Jan 4, 2020

Conversation

@ckipp01
Copy link
Member

ckipp01 commented Jan 4, 2020

Closes #1244

When I originally worked on this (my first Metals ticket 馃帀 ), I totally forgot about the case where you paste on the first line of the multi-line string. This adds in a check for that and also a test for it.

@ckipp01

This comment has been minimized.

Copy link
Member Author

ckipp01 commented Jan 4, 2020

[error] Failed tests:
[error] 	tests.BspSwitchLspSuite

Test failure seems to be unrelated.

@gabro
gabro approved these changes Jan 4, 2020
Copy link
Member

gabro left a comment

LGTM

@ckipp01 ckipp01 merged commit a3d7184 into scalameta:master Jan 4, 2020
11 of 12 checks passed
11 of 12 checks passed
windows-latest jdk-11 unit tests
Details
macOS-latest jdk-11 unit tests
Details
ubuntu-latest jdk-8 unit tests
Details
ubuntu-latest jdk-11 unit tests ubuntu-latest jdk-11 unit tests
Details
Sbt integration
Details
Maven integration
Details
Gradle integration
Details
Mill integration
Details
Pants integration
Details
LSP integration tests
Details
Scala cross tests
Details
Scalafmt/Scalafix/Docs
Details
@ckipp01 ckipp01 deleted the ckipp01:bugfix/multi-line-formatting branch Jan 4, 2020
}
case _ =>
val newText = defaultIndent + "|"
new TextEdit(new Range(zeroPos, zeroPos), newText)
val isFirstLineOfMultiLine = lineText.trim.contains("\"\"\"|")

This comment has been minimized.

Copy link
@olafurpg

olafurpg Jan 4, 2020

Member

What happens if the line doesn鈥檛 have a pipe? It鈥檚 optional

This comment has been minimized.

Copy link
@ckipp01

ckipp01 Jan 4, 2020

Author Member

If there is no pipe on the line it gets filtered out beforehand and the line never enters the formatPipeLine method. I suppose I should have added a test for this as well. I did just check it locally and that indeed is how it works.

This comment has been minimized.

Copy link
@ckipp01

ckipp01 Jan 4, 2020

Author Member

I just added another test for this #1249

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can鈥檛 perform that action at this time.