scalameta / metals

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

No notification when SBT import fails #4760

Open yadavan88 opened 1 year ago

yadavan88 commented 1 year ago

Describe the bug Metals with VSCode doesn't report any issue when there is an error with sbt import.

In my MacBook, I started using VsCode recently. However, if there is any issue with sbt import, it doesn't report it. I spent a lot of time trying to re-import, clean, compile and restart vs code. It was also not showing the "run/debug" annotation on the Main class. Later, when looking through the metals.log, I found out that there was actually import issue with one of the libraries. Once I fixed it, it started working.

To Reproduce Steps to reproduce the behavior:

Use this build.sbt and create a new project

scalaVersion := "2.12.17"
name := "hello-world"
organization := "ch.epfl.scala"
version := "1.0"
libraryDependencies += "com.lightbend.akka" %% "akka-stream-alpakka-sse" % "3.0.4"

Then create the Main class as:

object Main extends App {
  println("Hello, World!")
}

Import and build the project in vscode. Run the code through metals "run" dialog and it should be all fine.

Then, change the library version to "4.0.0" instead of 3.0.4:

libraryDependencies += "com.lightbend.akka" %% "akka-stream-alpakka-sse" % "4.0.0"

Import the project. You will see no error that it failed to resolve the dependency as 4.0.0 is available only for Scala 2.13.

The sbt import failure popup is not showing anymore

Expected behavior

Import successfully or show proper error message.

Screenshots

This is the screenshot after updating version Notice that there is no "run/debug" annotation.

image

Installation:

Additional context

Search terms

yadavan88 commented 1 year ago

Further Update: It seems this issue occurs only with bloop. If I change the build server to SBT, it does show the pop-up as shown below.

image
tgodzik commented 1 year ago

Thanks for reporting! We need to check if we properly show when the build import failed, this should warrant at least a message for the user.

G1ng3r commented 1 year ago

Hi, guys. Me and my colleagues looked into this issue and found out that bloopInstall ignores errors. Fix is here https://github.com/scalacenter/bloop/pull/1973