-
Notifications
You must be signed in to change notification settings - Fork 332
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
Scala 3 export statements Go To Definition/Hover is broken #4325
Comments
Thanks for the reproduction! I see great use of ScalCLI 🚀 |
Indeed Scala3 generates package `export-stmt`
object enumerations/*<-`export-stmt`::enumerations.*/:
trait SymbolKind/*<-`export-stmt`::enumerations.SymbolKind#*/
trait CymbalKind/*<-`export-stmt`::enumerations.CymbalKind#*/
object all/*<-`export-stmt`::all.*/:
export enumerations/*->`export-stmt`::enumerations.*/.*
@main/*->scala::main#*/ def hello/*<-`export-stmt`::`exports-stmt$package`.hello().*/ =
import all/*->`export-stmt`::all.*/.SymbolKind
import enumerations/*->`export-stmt`::enumerations.*/.CymbalKind
val x/*<-local2*/ = new SymbolKind/*->`export-stmt`::all.SymbolKind#*/ {}
val y/*<-local5*/ = new CymbalKind/*->`export-stmt`::enumerations.CymbalKind#*/ {} |
Ohh that's a nice view of the code! |
It's not a stupid question! In lampepfl/dotty repository, it provides a way to regression test for semanticdb. |
I'm wondering if we should see this behavior as "broken" 🤔
class Copier:
private val printUnit = new Printer { type PrinterType = InkJet }
private val scanUnit = new Scanner
export scanUnit.scan
export printUnit.{status as _, *}
|
I think it should be fine to jump to the export clause if it's more complex, but it would be cool to jump to the original if the export is for example a wildcard 🤔
100% agree, this could be a separate issue. |
I normally have a single file called |
Raised an upstream issue since it might be hard to figure out without the compiler support scala/scala3#19444 |
I just hit on another maybe related example of this, but the behavior is slightly different. I'll include it in here to double-check when this is fixed to see if it then also behaves correctly. The tricky part is that I can't get a minimal reproduction to behave the same, so something else might be at play. The minimal reproduction that I made was this: //> using scala 3.3.1
object Thing:
export Inner.example
private object Inner:
val example = ???
object Test:
Thing.example This behaves the same as what @keynmol describes. Where I hit on this in the wild where the behavior was slightly different was when triggering a goto definition on |
Describe the bug
Say you have a Scala CLI file like this (BSP doesn't matter, I originally spotted it in SBT project way back):
When you GTD on
SymbolKind
, it takes you toexport
statement - not to definition of the trait.When you hover on
SymbolKind
it showstype SymbolKind
, nottrait
.Expected behavior
If you try either of the two things above with
Cymbal
, it takes you to the definition and hover shows "trait".I'd expect the same work with
SymbolKind
, i.e. bypass theall
object and itsexport
statement completely and take you to the definition.Operating system
macOS
Editor/Extension
Nvim (nvim-metals)
Version of Metals
0.11.8+55-e48b5ad4-SNAPSHOT
Extra context or search terms
scala 3, export, hover, go to definition
The text was updated successfully, but these errors were encountered: