-
Notifications
You must be signed in to change notification settings - Fork 1
/
scala.el
55 lines (46 loc) · 1.87 KB
/
scala.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
;;; scala.el --- setup scala lsp in emacs
;;; commentary:
;;; code:
;; Enable defer and ensure by default for use-package
;; Keep auto-save/backup files separate from source code: https://github.com/scalameta/metals/issues/1027
(setq use-package-always-defer t
use-package-always-ensure t
backup-directory-alist `((".*" . ,temporary-file-directory))
auto-save-file-name-transforms `((".*" ,temporary-file-directory t)))
;; Enable scala-mode for highlighting, indentation and motion commands
(use-package scala-mode
:interpreter
("scala" . scala-mode))
;; Enable sbt mode for executing sbt commands
(use-package sbt-mode
:commands sbt-start sbt-command
:config
;; WORKAROUND: https://github.com/ensime/emacs-sbt-mode/issues/31
;; allows using SPACE when in the minibuffer
(substitute-key-definition
'minibuffer-complete-word
'self-insert-command
minibuffer-local-completion-map)
;; sbt-supershell kills sbt-mode: https://github.com/hvesalai/emacs-sbt-mode/issues/152
(setq sbt:program-options '("-Dsbt.supershell=false")))
;; Enable nice rendering of diagnostics like compile errors.
(use-package flycheck
:init (global-flycheck-mode))
(use-package lsp-mode
;; Optional - enable lsp-mode automatically in scala files
:hook (scala-mode . lsp)
(lsp-mode . lsp-lens-mode)
:config
;; Uncomment following section if you would like to tune lsp-mode performance according to
;; https://emacs-lsp.github.io/lsp-mode/page/performance/
;; (setq gc-cons-threshold 100000000) ;; 100mb
;; (setq read-process-output-max (* 1024 1024)) ;; 1mb
;; (setq lsp-idle-delay 0.500)
;; (setq lsp-log-io nil)
;; (setq lsp-completion-provider :capf)
(setq lsp-prefer-flymake nil)
(setq lsp-keep-workspace-alive nil))
;; Add metals backend for lsp-mode
(use-package lsp-metals)
(provide 'scala)
;;; scala.el ends here