From 89b37e3a44f05ecf275a1525046a6d751227a2fd Mon Sep 17 00:00:00 2001 From: Nikita Miazin Date: Thu, 30 Nov 2023 10:28:17 +0200 Subject: [PATCH] fix orElseFail inspection on Windows --- .../simplifications/SimplifyOrElseInspection.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/scala/zio/intellij/inspections/simplifications/SimplifyOrElseInspection.scala b/src/main/scala/zio/intellij/inspections/simplifications/SimplifyOrElseInspection.scala index 47b3f534..428dad4f 100644 --- a/src/main/scala/zio/intellij/inspections/simplifications/SimplifyOrElseInspection.scala +++ b/src/main/scala/zio/intellij/inspections/simplifications/SimplifyOrElseInspection.scala @@ -14,7 +14,9 @@ object OrElseFailSimplificationType extends SimplificationType { override def getSimplification(expr: ScExpression): Option[Simplification] = { def blockReplacement(zio: ScExpression, body: Seq[ScBlockStatement]): Simplification = { - val separator = System.lineSeparator + // new Intellij version doesn't seem to like Windows line separators + // if ScalaPsiElementFactory.createBlockWithGivenExpressions can use "\n", so can we + val separator = "\n" val blockBody = body.map(_.getText).mkString(separator, separator, separator) replace(expr).withText(s"${zio.getText}.$replaceWith {$blockBody}") }