Instructions on how I like to setup my local environment for Scala.
Use couriser
curl -fL https://github.com/VirtusLab/coursier-m1/releases/latest/download/cs-aarch64-apple-darwin.gz | gzip -d > cs
chmod +x cs
./cs setup --yes --jvm 17 --apps cs,sbt,bloop,scala-cli
rm cshttps://get-coursier.io/docs/cli-installation#zsh-completions
cs java --jvm 17 --setup
cs java --jvm 8 --setup- add bloop tab completion for zsh
# https://github.com/scalacenter/bloop/releases
mkdir -p "$HOME/.bloop"
curl -L https://github.com/scalacenter/bloop/releases/download/v1.5.15/zsh-completions -o "$HOME/.bloop/zsh-completions"
ln -s "$HOME/.bloop/zsh-completions" $HOME/.zsh/completions/_bloop
Use scalafmt-native for integration with sublime-fmt
Using a scalafmt-native-launcher.
ln -s "${PWD}/scalafmt-native-launcher.sh" /usr/local/bin/scalafmt-native
mkdir -p "$HOME/.scalafmt-native"Uses bloop to determine which project your Scala file belongs in
ln -s "${PWD}/bloop-which-project.sh" /usr/local/bin/bloop-which-projectThis is used in conjuction with the bloop.sublime-build
Sublime FMT settings
{
"rules": [
{
"selector": "source.scala",
"cmd": [
"scalafmt-native",
"--stdin",
"--assume-filename",
"$file_name",
"--stdout",
"--non-interactive"
],
}
],
"cwd_mode": "project_root",
"format_on_save": true
}