This layer adds support for Scala development in Emacs, via Metals and lsp-mode.
It does not depend on Ensime, in contrast to the current official Scala layer.
- Documentation for function at point
- Type hints for value at point
- SBT integration with a hydra
Clone this repository into your .emacs.d/private
folder (or wherever your
private layers should go), and then add escala
to
dotspacemacs-configuration-layers
in your /.spacemacs
You also need to install the Metals LSP server. Up-to-date instructions can be found on their website, linked further up. As of May 2019, the installation can be summarized as:
# Make sure to use coursier v1.1.0-M9 or newer.
curl -L -o coursier https://git.io/coursier
chmod +x coursier
./coursier bootstrap \
--java-opt -Xss4m \
--java-opt -Xms100m \
--java-opt -Dmetals.client=emacs \
org.scalameta:metals_2.12:0.5.2 \
-r bintray:scalacenter/releases \
-r sonatype:snapshots \
-o /usr/local/bin/metals-emacs -f
Also, please note that the Metals server, when started from the Spacemacs LSP
layer, needs to find Java 8. You can set a local version of Java using jenv, or
setting JAVA_HOME
within the .spacemacs.env
file. **This will also cause
sbt
to work with Java 8** when using this layer. We are thinking of a
workaround …
To use this configuration layer, add it to your ~/.spacemacs
. You will need to
add escala
to the existing dotspacemacs-configuration-layers
list in this
file.
Key Binding | Description |
---|---|
SPC m b b | Run sbt command |
SPC m b . | Start sbt hydra |
Please check the lsp-mode documentation.