scalameta / metals

Scala language server with rich IDE features 🚀
https://scalameta.org/metals/
Apache License 2.0
2.09k stars 331 forks source link

(heisenbug) `annotation.Int` shown instead of `Int` in completions sometimes #6794

Open kubukoz opened 3 weeks ago

kubukoz commented 3 weeks ago

Describe the bug

I first bumped into this in a small codebase, but it had a few more dependencies so I tried to isolate it to just fs2.

Although I don't have a reliable reproduction, I managed to hit this again with just fs2 in a fairly short recording (starts with a metals restart - see below)

This is on Scala 3.5.0, with scala-cli.

Actual behavior:

heisenbug

It happens once or twice and never happens again... until it does. Feels very random.

How I got there:

https://github.com/user-attachments/assets/6e6be344-e40d-4f13-a1dc-a6280901a45b

(I tried all sorts of things that could mess with the state, e.g. creating a new file, completing on a broken file etc.)

Initial code:

//> using dep co.fs2::fs2-core:3.11.0
import cats.effect.IO

object main {

  def asdf(s: fs2.Stream[IO, Int]) =
    s
      .as(42)
      .buffer(1902379)
      .buffer(???)
      .flatMap(_ => fs2.Stream.unit.covary[IO])

  def x(a: IO[Unit]) = IO
    .uncancelable(_ => a.delayBy(???))
    .andWait(???) *> a *> a <* a

}

Expected behavior

image

Operating system

macOS

Editor/Extension

VS Code

Version of Metals

v1.3.5

Extra context or search terms

No response

tgodzik commented 3 weeks ago

Thanks for reporting! Any chance you could attach the code in question?

kubukoz commented 3 weeks ago

oops, sorry. Added to the issue.