5

This code does compile and run with mill, but intellisense shows error "object pwd is not a member of package foo.os bloop"

//main.scala
package foo

object Exercise{
    def main(args: Array[String]): Unit = {
        println(os.pwd)
    }
}

//build.sc
import mill._, scalalib._

object foo extends ScalaModule {
  def scalaVersion = "2.13.1"

  def ivyDeps = Agg(
    ivy"com.lihaoyi::os-lib:0.7.8"
  )
}

I have metals vscode extension and it does recognize os-lib in project libraries. And it does show type for the os.pwd, but it still shows the error.

usermine12
  • 77
  • 1
  • 7

1 Answers1

4

On occasions VS Code's Scala plugin Metals suddenly stops working, and I get red lines under everything, and intellisense stop working, even when sbt compile works fine.

I found a simple fix that got Metals under VS Code back to working again:

# Exit VS Code
cd your/project/dir
rm -rf .bloop
rm -rf .metals

# Sometimes a running bloop can cause problems so find and stop it
ps -ef | grep -i bloop

kill <bloop process id>

code .

It seems like Bloop and Metals got into an inconsistent state, and deleting the hidden directories will force both to restart.

Sami Badawi
  • 977
  • 1
  • 10
  • 22