Open
Description
Describe the bug
I'm not sure whether this is something that matters in practice. Even in DSL contexts, I'm struggling to think of a case where multiple consecutive spaces would occur in a single identifier. I came up with this while trying to reverse engineer some failure that was reported to me, but it later transpired this was not the root cause.
Nonetheless, here's a sample failing test:
diff --git a/tests/cross/src/test/scala/tests/hover/HoverDefnSuite.scala b/tests/cross/src/test/scala/tests/hover/HoverDefnSuite.scala
index cc78de43532..085e0737e2c 100644
--- a/tests/cross/src/test/scala/tests/hover/HoverDefnSuite.scala
+++ b/tests/cross/src/test/scala/tests/hover/HoverDefnSuite.scala
@@ -277,4 +277,14 @@ class HoverDefnSuite extends BaseHoverSuite {
|""".stripMargin,
"val foo: Int".hover
)
+
+ check(
+ "backticked",
+ """|object A {
+ |
+ | <<val `foo @@ bar`: Int = 123>>
+ |}
+ |""".stripMargin,
+ "val `foo bar` = 123".hover
+ )
}
Instead of showing the definition of foo bar
, metals shows nothing. If there's one less space (so foo bar
), the problem doesn't occur because either one of foo@@ bar
or foo @@bar
registers as non-whitespace hover.
Fix is probably similar to #7119
Expected behavior
Show the definition as in the test case.
Operating system
macOS
Editor/Extension
VS Code
Version of Metals
1.6.0
Scala version/s
2.13.16
Extra context or search terms
No response