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

VSCode Metals fails to fire a bsp server in WSL2

yuxuan-z19 opened this issue · comments

Describe the bug

Windows 11 23H2 \w WLS2 Ubuntu 22.04

I'm developing a SpinalHDL project in WSL v2.1.5.0 using mill 0.11.7. As the extension is upgraded to v1.30.0 (Metals 1.3.0+30-f09200f0-SNAPSHOT), it is not working well again. The log provided here suggests the extension cannot launch a BSP server.

I know it's odd: the extension ALWAYS works well on a native Linux system, BUT NOT WSL2.

Expected behavior

No response

Operating system

Linux

Editor/Extension

VS Code

Version of Metals

v1.3.0+30-f09200f0-SNAPSHOT

Extra context or search terms

No response

I've switched to openjdk-17 as suggested in #6314; deleting all caches (.cache, .mill, .bloop, .bsp etc.) can't solve the issue

Thanks for reporting! It seems something is wrong with the setup.

I can see that it's downloading Mill twice. Did you delete anything in between? I think someone had a similar issue when their directory was on Windows which the path /mnt... seems to suggest. Is it possible for you to move the project to /home/... and see if that helps?

Alternatively you can use Switch BSP server command to try out with Mill bsp

Hey @tgodzik I figured it out: the server downloads another Java-17 with coursier, though I've installed openjdk-17 using apt, and it calls the Java-17 downloaded instead. I guess there's something wrong with the JAVA_HOME which should be set by default (set to which java if I'm not mistaken).
Metals v1.2.2 works perfectly by the way.

I did a number of updates that should pick up Java from PATH also, there should also be more information in the Metals output about what is going on exactly.

Why is the downloaded Java not working though?