Skip to content
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

Auto complete (missing) extension methods #282

Closed
tanishiking opened this issue Jul 14, 2022 · 2 comments
Closed

Auto complete (missing) extension methods #282

tanishiking opened this issue Jul 14, 2022 · 2 comments
Assignees

Comments

@tanishiking
Copy link
Member

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

Somehow related to #141

In the code example below, Metals doesn't complete incr, and only if we import a.IntEnrichment.incr in B.scala Metals can complete incr there.

// A.scala
package a
object IntEnrichment:
  extension (num: Int)
    def incr: Int = num + 1

// B.scala
package b

def main =
  1.in@@

As a result of the lack of code completion for the missing extension method, developers have to seek the extension method and import it manually. It is quite time-consuming and sometimes leads developers to write the duplicated method because they couldn't find the one.

Describe the solution you'd like

// A.scala
package a
object IntEnrichment:
  extension (num: Int)
    def incr: Int = num + 1

// B.scala
package b

def main =
  1.in@@

complete for incr and auto-import a.IntEnrichment.incr.

// B.scala
package b

import a.IntEnrichment.incr

def main =
  1.incr

Describe alternatives you've considered

auto-importing missing extension method may help scalameta/metals#4141 but it doesn't make us easier to find an extension method we want without knowing.

Additional contex

No response

Search terms

extension method / auto-completion

@tanishiking
Copy link
Member Author

I think this will be possible as we index the extension method in scalameta/metals#4141

@tanishiking
Copy link
Member Author

closing for scalameta/metals#4183

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant