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

Implicit parameters inlay hints unstable with Scala 3

jeengbe opened this issue · comments

Describe the bug

To Reproduce Steps to reproduce the behavior:

  1. Set up a blank project with:
// ThisBuild / scalaVersion := "2.13.12"
ThisBuild / scalaVersion := "3.3.3"

lazy val root = (project in file("."))
  .settings(
    libraryDependencies := Seq(
      "org.typelevel" %% "cats-core" % "2.10.0"
    )
  )

and

import cats.Applicative
import cats.data.Validated
import cats.data.ValidatedNec
import cats.implicits._
import cats.syntax.all._

class A {
  type Validated[A] = ValidatedNec[Nothing, A]

  val a = implicitly[Applicative[Validated]].pure(1)
}
  1. Start Metals with Scala 3
  2. Observe no inline hint:
    image
  3. Switch to Scala 2
  4. Observe expected inlay hint:
    image

Expected behavior

The inlay hint should show in Scala 3 too.

Installation:

  • Operating system: Linux version 5.15.133.1-microsoft-standard-WSL2 (root@1c602f52c2e4) (gcc (GCC) 11.2.0, GNU ld (GNU Binutils) 2.37) scalameta/metals-vscode#1 SMP Thu Oct 5 21:02:42 UTC 2023
  • VSCode version: 1.88.1
  • VSCode extension version: v1.30.0
  • Metals version: 1.3.0

Additional context

It's not that they don't work at all for Scala 3. It's just rare that they do and very unstable/arbitrary.

Also, interestingly, this seems to only be an issue in some cases: Applicative[List] works fine with Scala 3 every time:

image

Search terms

inlay hints implicit parameter not showing buggy inconsistent

Thanks for reporting! We need to take a look at the reproduction to see what is the issue here.