yayuyo
yayuyo

Reputation: 25

How to set up Scala(Metals) with WSL

I'm trying to use VSCode as an IDE to develop Scala applications in an environment with WSL.

I installed Scala(Metals), but it doesn't work and has no VSCode intellisense feature.

error details

When I open the Metals pane and click the “New Scala project” or “Start Metals” button on the packages tab, there is no response.

by executing Command 'Metals: Connect to build server' returns "resulted in an error command 'metals.build-connect' not found "

my setups

WSL

WSL V2

$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

I also set workspace settings.json:

  "metals.javaHome": "/usr/lib/jvm/java-11-openjdk-amd64"

Java, sbt

I installed java and sbt using sdkman.

$ sdk version

SDKMAN!
script: 5.18.2
native: 0.4.6

$ sudo update-alternatives --config java
There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-11-openjdk-amd64/

$ java -version
openjdk version "11.0.23" 2024-04-16
OpenJDK Runtime Environment (build 11.0.23+9-post-Ubuntu-1ubuntu122.04.1)
OpenJDK 64-Bit Server VM (build 11.0.23+9-post-Ubuntu-1ubuntu122.04.1, mixed mode, sharing)

$ sbt --version
sbt script version: 1.9.9

What other settings do I need?

Upvotes: 0

Views: 245

Answers (0)

Related Questions