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

“Insert type annotation” wrongly infers `Any` type

mberndt123 opened this issue · comments

Describe the bug

  1. Clone this repo: https://github.com/zio/zio-http/
  2. check out commit ade9245c (current main as of this writing)
  3. open the project using VS Code, import project (bloop or sbt, doesn't matter)
  4. Remove the type annotation from val live in object NettyClientDriver, save file
  5. use the insert type annotation feature to add the type annotation again

Metals will infer Any instead of the correct type

Expected behavior

The inferred type should be ZLayer[NettyConfig, Nothing, NettyClientDriver]

Operating system

Linux

Editor/Extension

VS Code

Version of Metals

v1.3.1

Extra context or search terms

No response

Another issue is:

In the same file, go to line 89. Position the cursor on line 89 between the leading dot and the word customHeaders. Trigger code completion -> works fine, you get all the right methods.

Move the cursor to line 90 between the leading dot and the word webSocketUri. Trigger code completion -> You only get junk.

Looking into the project it seems that for both Bloop and sbt BSP it's failing. The weirdest thing is that the presentation compiler seems to be sending us errors all around 🤔

It looks mostly fine in the Metals doctor though 🤷🏻‍♂️
doctor
Perhaps it is somehow related to the sbt-projectmatrix plugin?

Not sure, either presentation compiler is doing something weird or we are giving it a wrong classpath somehow.