Scala layer for Spacemacs, using lsp instead of ensime, based on the original Scala layer and this pull request https://github.com/syl20bnr/spacemacs/pull/12234/files.
This layer does wonderful things:
- there is no dependency of ensime, instead we use Metals with language server protocol (lsp)
First make sure you have the latest version of metals-emacs
, as of 2019-07-10,
the latest version can be built using the following commands:
# 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.7.0 \
-r bintray:scalacenter/releases \
-r sonatype:snapshots \
-o /usr/local/bin/metals-emacs -f
Now, you have to clone the repository in your `~/.emacs.d/private` folder, and
then add `scala-lsp` into existing dotspacemacs-configuration-layers
list in
~/.spacemacs
file.
dotspacemacs-configuration-layers
'(
....
scala-lsp)
I also recommend to add this settings into your Spacemacs config to enable auto completion.
(setq company-lsp-async t)
;; Hack to make sure 'company-lsp is only pushed after company package is loaded
(use-package company
:config
(push 'company-lsp company-backends))
See http://develop.spacemacs.org/layers/+tools/lsp/README.html#key-bindings