All Projects → zheli → scala-lsp

zheli / scala-lsp

Licence: GPL-3.0 License
Scala layer for Spacemacs, using lsp + metals instead of ensime.

Programming Languages

emacs lisp
2029 projects

scala-lsp layer

img/scala.png with img/scalameta.png

Table of Contents

Description

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)

Install

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))

Key bindings

See http://develop.spacemacs.org/layers/+tools/lsp/README.html#key-bindings

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].