scalacenter / scalafix

Refactoring and linting tool for Scala
https://scalacenter.github.io/scalafix/
BSD 3-Clause "New" or "Revised" License
830 stars 186 forks source link

Improve semantic information for types compiled by dotty #2049

Open bjaglin opened 2 months ago

bjaglin commented 2 months ago

The SymbolTable required by core for finding information that is not available in SemanticDB is injected by cli using a helper from reflect, which is currently backed by scalameta's internal semanticdb-scalac-core which was written for Scala 2 class files.

https://github.com/scalacenter/scalafix/blob/c6d741174abf76c01862a2aac1b52379b106c5d9/scalafix-core/src/main/scala/scalafix/internal/v1/InternalSemanticDoc.scala#L68-L82

https://github.com/scalacenter/scalafix/blob/c6d741174abf76c01862a2aac1b52379b106c5d9/scalafix-cli/src/main/scala/scalafix/internal/v1/Args.scala#L200-L212

https://github.com/scalacenter/scalafix/blob/c6d741174abf76c01862a2aac1b52379b106c5d9/scalafix-reflect/src/main/scala/scalafix/internal/reflect/ClasspathOps.scala#L27-L33

We need to migrate to https://github.com/scalacenter/tasty-query or equivalent to provide exhaustive information about types compiled by dotty. While doing that, we should drop the need to using Scalameta internal structures as a contract between core & cli.

tgodzik commented 2 months ago

An alternative is to use info method that we added to the presentation compiler. It provides a similar interface as semanticdb.

bjaglin commented 2 months ago

Interesting! Do you know what's the PC overhead? In terms of start up time (I guess in Metals it's warm no it does not matter much) and RAM footprint?

tgodzik commented 2 months ago

The overhead shouldn't be too big, but it's hard to say. It's basically the addition of the compiler, which would already be added when I manage to finish the inferred type PR.