From 162f30c6f62a2110be6e2a48b860287cef5cf343 Mon Sep 17 00:00:00 2001 From: Tomasz Godzik Date: Fri, 15 Nov 2024 20:08:13 +0100 Subject: [PATCH] improvement: Do not show positions for synthetic params --- .../scala-2/scala/meta/internal/pc/PcInlayHintsProvider.scala | 4 +++- tests/cross/src/test/scala/tests/pc/InlayHintsSuite.scala | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/mtags/src/main/scala-2/scala/meta/internal/pc/PcInlayHintsProvider.scala b/mtags/src/main/scala-2/scala/meta/internal/pc/PcInlayHintsProvider.scala index 4a4251f887e..840a84a145d 100644 --- a/mtags/src/main/scala-2/scala/meta/internal/pc/PcInlayHintsProvider.scala +++ b/mtags/src/main/scala-2/scala/meta/internal/pc/PcInlayHintsProvider.scala @@ -127,7 +127,9 @@ final class PcInlayHintsProvider( } private def labelPart(symbol: Symbol, label: String) = - if (symbol.pos.source == pos.source) { + if (symbol.isSynthetic && !symbol.isMethod) { + LabelPart(label) + } else if (symbol.pos.source == pos.source) { val pos = if (symbol.pos.start != symbol.pos.point) { symbol.pos.withStart(symbol.pos.point) } else { diff --git a/tests/cross/src/test/scala/tests/pc/InlayHintsSuite.scala b/tests/cross/src/test/scala/tests/pc/InlayHintsSuite.scala index 34c266c86be..e151c0a1d20 100644 --- a/tests/cross/src/test/scala/tests/pc/InlayHintsSuite.scala +++ b/tests/cross/src/test/scala/tests/pc/InlayHintsSuite.scala @@ -986,7 +986,7 @@ class InlayHintsSuite extends BaseInlayHintsSuite { |""".stripMargin, """|object Main{ | implicit def stringLength(s: String): Int = s.length - | implicitly[String => Int]/*((s: String<>) => stringLength<<(2:15)>>(s<<(3:12)>>)))*/ + | implicitly[String => Int]/*((s: String<>) => stringLength<<(2:15)>>(s)))*/ | | implicit val namedStringLength: String => Long = (s: String) => s.length.toLong | implicitly[String => Long]/*(namedStringLength<<(5:15)>>)*/ @@ -1013,7 +1013,7 @@ class InlayHintsSuite extends BaseInlayHintsSuite { |""".stripMargin, """|object Main{ | implicit def stringLength(s: String, i: Int): Int = s.length - | implicitly[(String, Int) => Int]/*((s: String<>, i: Int<>) => stringLength<<(2:15)>>(s<<(3:12)>>, i<<(3:12)>>)))*/ + | implicitly[(String, Int) => Int]/*((s: String<>, i: Int<>) => stringLength<<(2:15)>>(s, i)))*/ |} |""".stripMargin, compat = Map(