Interactive setup for Scala LSP development environment
Sets up Scala LSP environment with Metals, scalafmt, and scalafix using Coursier. Use this to enable code intelligence, formatting, and linting for Scala development in Claude Code.
/plugin marketplace add zircote/scala-lsp/plugin install scala-lsp@zircote-lspThis command will configure your Scala development environment with Metals and essential tools.
First, verify Coursier is installed:
cs --version
If not installed:
brew install coursier/formulas/coursier
cs install metals
# Formatting
cs install scalafmt
# Linting and refactoring
cs install scalafix
metals --version
scalafmt --version
export ENABLE_LSP_TOOL=1
Test the LSP integration:
# Create a test file
cat > test_lsp.scala << 'EOF'
object Main extends App {
def greet(name: String): String = s"Hello, $name!"
println(greet("World"))
}
EOF
# Run Scalafmt
scalafmt test_lsp.scala
# Clean up
rm test_lsp.scala