Skip to content

Commit

Permalink
Merged branch idea243.release into idea243.x
Browse files Browse the repository at this point in the history
  • Loading branch information
builduser committed Dec 12, 2024
2 parents c0779aa + ed26a99 commit 42fb27f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import org.jetbrains.plugins.scala.extensions._
import org.jetbrains.plugins.scala.lang.TokenSets
import org.jetbrains.plugins.scala.lang.formatting.ScalaBlock
import org.jetbrains.plugins.scala.lang.formatting.settings.ScalaCodeStyleSettings
import org.jetbrains.plugins.scala.lang.lexer.{ScalaKeywordTokenType, ScalaTokenType, ScalaTokenTypes, ScalaTokenTypesEx, ScalaXmlTokenTypes}
import org.jetbrains.plugins.scala.lang.lexer.{ScalaTokenType, ScalaTokenTypes, ScalaTokenTypesEx, ScalaXmlTokenTypes}
import org.jetbrains.plugins.scala.lang.parser.{ScCodeBlockElementType, ScalaElementType}
import org.jetbrains.plugins.scala.lang.psi.api.ScalaFile
import org.jetbrains.plugins.scala.lang.psi.api.base._
Expand All @@ -39,6 +39,7 @@ import org.jetbrains.plugins.scala.lang.scaladoc.parser.ScalaDocElementTypes
import org.jetbrains.plugins.scala.lang.scaladoc.psi.api.ScDocComment
import org.jetbrains.plugins.scala.util.MultilineStringUtil
import org.jetbrains.plugins.scalaDirective.lang.parser.ScalaDirectiveElementTypes
import org.jetbrains.plugins.scalaDirective.psi.api.ScDirectiveToken

import scala.annotation.{nowarn, tailrec}

Expand Down Expand Up @@ -1057,7 +1058,7 @@ object ScalaSpacingProcessor extends ScalaTokenTypes {
if (rightBlockString.startsWith(".") &&
rightElementType != ScalaTokenType.Float &&
rightElementType != ScalaTokenType.Double &&
!rightPsi.isInstanceOf[ScLiteral]) {
!rightPsi.is[ScLiteral, ScDirectiveToken]) {
return WITHOUT_SPACING
}
if (rightBlockString.startsWith(",")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,16 @@ class ScalaDirectiveFormattingTest extends AbstractScalaFormatterTestBase {
|// Foo
|""".stripMargin
)

// SCL-23326
def test_do_not_merge_tokens_starting_with_dot(): Unit = doTextTest(
"""
|//> using file ../common/util.scala
|//> using file ../common/util.scala
|""".stripMargin,
"""
|//> using file ../common/util.scala
|//> using file ../common/util.scala
|""".stripMargin
)
}

0 comments on commit 42fb27f

Please sign in to comment.