Open
Description
Minimized code
Running:
val pos = sourcePosition(driver, params, uri)
val trees = driver.openedTrees(uri)
val path = Interactive.pathTo(trees, pos)
val tp = Interactive.enclosingType(trees, pos)
val tpw = tp.widenTermRefExpr
on
import java.nio.file.{Files => File,Pa@@ths}
will produce type tree:
val tpw = ImportType(Select(Select(Ident(java),nio),file))
and on
tpw.show()
it will just produce:
ImportType(Select(Select(Ident(java),nio),file))
Expectation
java.nio.file.Paths
is produced
This most likely caused by two issues:
- ImportType is ignored by show and possibly in Printers (not sure how the two relate)
- Interactive.enclosingType(trees, pos) should give us the Tree representing
java.nio.file.Paths
This come up when running tests in the Metals codebase. Would gladly want to fix it here, but not sure where to start or maybe I could be totally mistaken.