scalameta / metals-feature-requests

Issue tracker for Metals feature requests
37 stars 4 forks source link

View of implicits in scope #362

Open iusildra opened 9 months ago

iusildra commented 9 months ago

Is your feature request related to a problem? Please describe.

While implicits are awesome, they can sometimes be tricky and it can be hard to find the right instance of implicit used in a given scope

// File A
object implicits:
  def foo(x: Int)(using y: Int): Int = x + y

object test:
  implicits.foo(1) // (given_Int) <- where is it defined ?

// File B
given Int = 42

Describe the solution you'd like

A view of the implicits in the current scope, to then display it somewhere in the IDE. For the example above, it could return

B.given_Int

(This could also help lower the difficulty for newcomers)

Describe alternatives you've considered

None

Additional context

No response

Search terms

implicit, given, context

tgodzik commented 9 months ago

Thanks for reporting! You should be able to go to definition via the link in hover over implicit parameter decoration (can be turned on in the settings)

image

We will be working on adding inlay hints instead, which should be much easier to use.