scalameta / metals

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

Goto definition for standard library stop working after running `scala setup-ide .` with simple script file #6900

Open dragove opened 1 day ago

dragove commented 1 day ago

Describe the bug

Minimal Steps to reproduce:

mkdir re
cd re
echo 'println("hi")' > demo.sc
scala setup-ide .
code .

and open demo.sc in vscode. goto definition and documentation becomes broken.

My environment:

Scala code runner version: 1.4.3
Scala version (default): 3.5.2

vscode Scala (Metals) v1.41.0

Expected behavior

Goto definition and documentations working

Operating system

Linux

Editor/Extension

VS Code

Version of Metals

v1.4.0

Extra context or search terms

with scala-cli version as follow:

Scala CLI version: 1.5.1
Scala version (default): 3.5.1

do following steps make things working again:

rm .bsp/scala.json
scala-cli setup-ide .

here are copy pastes from scala.json and scala-cli.json

// scala.json
{
  "name": "scala",
  "argv": [
    "/home/dove/.cache/coursier/arc/https/github.com/scala/scala3/releases/download/3.5.2/scala3-3.5.2-x86_64-pc-linux.tar.gz/scala3-3.5.2-x86_64-pc-linux/bin/scala-cli",
    "--cli-default-scala-version",
    "3.5.2",
    "--repository",
    "file:///home/dove/.cache/coursier/arc/https/github.com/scala/scala3/releases/download/3.5.2/scala3-3.5.2-x86_64-pc-linux.tar.gz/scala3-3.5.2-x86_64-pc-linux/maven2",
    "--prog-name",
    "scala",
    "bsp",
    "--json-options",
    "/home/dove/Workspace/Scala/demo/.scala-build/ide-options-v2.json",
    "--json-launcher-options",
    "/home/dove/Workspace/Scala/demo/.scala-build/ide-launcher-options.json",
    "--envs-file",
    "/home/dove/Workspace/Scala/demo/.scala-build/ide-envs.json",
    "/home/dove/Workspace/Scala/demo"
  ],
  "version": "1.4.3",
  "bspVersion": "2.1.1",
  "languages": [
    "scala",
    "java"
  ]
}
// scala-cli.json
{
  "name": "scala-cli",
  "argv": [
    "/home/dove/.local/share/coursier/bin/.scala-cli.aux",
    "bsp",
    "--json-options",
    "/home/dove/Workspace/Scala/demo/.scala-build/ide-options-v2.json",
    "--json-launcher-options",
    "/home/dove/Workspace/Scala/demo/.scala-build/ide-launcher-options.json",
    "--envs-file",
    "/home/dove/Workspace/Scala/demo/.scala-build/ide-envs.json",
    "/home/dove/Workspace/Scala/demo"
  ],
  "version": "1.5.1",
  "bspVersion": "2.1.1",
  "languages": [
    "scala",
    "java"
  ]
}
tgodzik commented 1 day ago

Thanks for reporting!