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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: workaround for hover for multi declaraction (Scala 3) #7037

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,13 @@ object MetalsInteractive:
*/
else if head.isInstanceOf[TypeTree] then
enclosingSymbolsWithExpressionType(tail, pos, indexed)
else Nil
else
path match
case (_: ValDef) :: (t : Template) :: _ =>
t.body.collectFirst {
case d: ValDef if d.nameSpan.contains(pos.span) => List((d.symbol, d.symbol.info))
}.getOrElse(Nil)
case _ => Nil
else
val recovered = recoverError(head, indexed)
if recovered.isEmpty then
Expand Down
10 changes: 10 additions & 0 deletions tests/cross/src/test/scala/tests/hover/HoverTermSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -773,4 +773,14 @@ class HoverTermSuite extends BaseHoverSuite {
)
)

check(
"i7012".tag(IgnoreScala2),
"""|object O {
| val x@@x, yy, zz = 1
|}
|""".stripMargin,
"""|
|val xx: Int
|""".stripMargin.hover
)
}
Loading