A Claude Code plugin that integrates Metals, the Scala Language Server.
- Code completions
- Go to definition / references
- Hover documentation
- Diagnostics (errors/warnings)
- Code formatting (via Scalafmt)
- Supports
.scala,.sc, and.sbtfiles
Java 11 or later is required. Install via one of:
- SDKMAN (recommended):
sdk install java 17.0.8-zulu - Homebrew:
brew install openjdk@17 - Nix:
nix-env -iA nixpkgs.jdk17 - asdf:
asdf plugin add java && asdf install java openjdk-17 - jabba:
jabba install openjdk@17
# Install Coursier if needed
brew install coursier/formulas/coursier # macOS
# or: curl -fL https://github.com/coursier/coursier/releases/latest/download/cs-x86_64-pc-linux.gz | gzip -d > cs && chmod +x cs && ./cs setup
# Install Metals
cs install metals
# Verify
metals --versionnix-env -iA nixpkgs.metalsAdd to your ~/.claude/settings.json:
{
"enabledPlugins": {
"/path/to/scala-lsp": true
}
}Or clone and add:
git clone https://github.com/Veske/scala-lsp.git ~/.claude/plugins/scala-lspThen add "~/.claude/plugins/scala-lsp": true to enabledPlugins.
The LSP will auto-connect when you open Scala files.
The metals-launcher script automatically discovers:
- Java: SDKMAN, jabba, asdf, Homebrew, Nix, macOS
java_home, system PATH - Metals: Coursier bin directory, Nix profile, system PATH
Ensure Java 11+ is available:
java -versionIf using a version manager, ensure it's initialized in your shell profile.
If installed via Coursier, add to your shell profile:
export PATH="$PATH:$HOME/.local/share/coursier/bin"
# or on macOS:
export PATH="$PATH:$HOME/Library/Application Support/Coursier/bin"Metals works best with a build tool. Ensure your project has one of:
build.sbt(sbt)build.sc(Mill)pom.xml(Maven)
Apache-2.0