Skip to content

Commit

Permalink
fix: Highlight for named arguments in Scala 2
Browse files Browse the repository at this point in the history
Previously, we were incorrectly highlighting all named arguments for case class
  • Loading branch information
jkciesluk authored and tgodzik committed Jun 19, 2023
1 parent def5892 commit d97fd1f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ abstract class PcCollector[T](
.filter(_.isConstructor)
.flatMap(_.paramss)
.flatten
.filter(_.name == id.name)
.toSet
(
(constructorParams ++ Set(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,34 @@ class DocumentHighlightSuite extends BaseDocumentHighlightSuite {
|}""".stripMargin,
)

check(
"named-arg",
"""
|case class Foo(foo: Int, <<bar>>: Int)
|object Main {
| val x = Foo(
| foo = 123,
| <<ba@@r>> = 456
| )
|
|}""".stripMargin,
)

check(
"named-arg1",
"""
|case class Foo(<<foo>>: Int, bar: Int)
|object Main {
| val x = Foo(
| <<fo@@o>> = 123,
| bar = 456
| )
| val y = x.<<foo>>
|
|
|}""".stripMargin,
)

check(
"scopes",
"""
Expand Down

0 comments on commit d97fd1f

Please sign in to comment.