scalameta / metals

Scala language server with rich IDE features 🚀

Home Page:https://scalameta.org/metals/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Extract selection as method doesn't infer correct return type

brndt opened this issue · comments

Describe the bug

  1. For instance write ZIO.succeed(true) and try to extract it as a method
  2. The method is extracted but the return type is not correct and some pieces are not imported
Screenshot 2024-06-03 at 18 14 06

Expected behavior

The return type should be inferred correctly with all missing stuff imported.

Maybe also it'd be better not to put the return type or at least add this possibility to the preferences.

Operating system

macOS

Editor/Extension

VS Code

Version of Metals

v1.3.1

Extra context or search terms

No response

Self contained reproduction:

object O {
  class C
  def foo(i: Int)(implicit o: C) = i
  val o = {
    implicit val c = new C
    foo(2) //extract this as method or val
    ???
  }
}