2015-01-14 04:12:56 +00:00
|
|
|
;;; packages.el --- Scala Layer packages File for Spacemacs
|
|
|
|
;;
|
2020-05-16 21:32:30 +00:00
|
|
|
;; Copyright (c) 2012-2020 Sylvain Benner & Contributors
|
2015-01-14 04:12:56 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
2020-05-16 21:32:30 +00:00
|
|
|
(defconst scala-packages
|
|
|
|
'(
|
|
|
|
lsp-mode
|
[scala] remove long-deprecated Ensime integration
According to its website, the Ensime project has been shut down since 2019. We
have been supporting both Ensime and Metals for [a year and a
half](https://github.com/syl20bnr/spacemacs/pull/12234#issuecomment-524916394).
Ensime's GitHub repositories, including its Emacs integration, are archived.
Meanwhile, Metals has been developed actively, regularly releasing new versions.
It has stabilized significantly, and supports an increasingly full set of
features. Scala 3 is just around the corner, and the community is poised to make
the transition smoothly and relatively quickly. Metals supports it already,
whereas of course Ensime does not and never will. In fact, Scala 2 has had
several import minor versions released since Ensime died. Now that it's 2021,
it's time to cut the baggage we are carrying around for Ensime.
2021-01-11 16:14:01 +00:00
|
|
|
lsp-metals
|
2020-05-16 21:32:30 +00:00
|
|
|
dap-mode
|
|
|
|
flycheck
|
|
|
|
flyspell
|
|
|
|
counsel-gtags
|
|
|
|
ggtags
|
|
|
|
helm-gtags
|
|
|
|
sbt-mode
|
|
|
|
scala-mode))
|
2014-12-14 04:29:23 +00:00
|
|
|
|
2016-07-16 05:30:56 +00:00
|
|
|
(defun scala/post-init-flycheck ()
|
[scala] remove long-deprecated Ensime integration
According to its website, the Ensime project has been shut down since 2019. We
have been supporting both Ensime and Metals for [a year and a
half](https://github.com/syl20bnr/spacemacs/pull/12234#issuecomment-524916394).
Ensime's GitHub repositories, including its Emacs integration, are archived.
Meanwhile, Metals has been developed actively, regularly releasing new versions.
It has stabilized significantly, and supports an increasingly full set of
features. Scala 3 is just around the corner, and the community is poised to make
the transition smoothly and relatively quickly. Metals supports it already,
whereas of course Ensime does not and never will. In fact, Scala 2 has had
several import minor versions released since Ensime died. Now that it's 2021,
it's time to cut the baggage we are carrying around for Ensime.
2021-01-11 16:14:01 +00:00
|
|
|
(spacemacs/enable-flycheck 'scala-mode))
|
2017-02-09 22:22:38 +00:00
|
|
|
|
|
|
|
(defun scala/post-init-flyspell ()
|
[scala] remove long-deprecated Ensime integration
According to its website, the Ensime project has been shut down since 2019. We
have been supporting both Ensime and Metals for [a year and a
half](https://github.com/syl20bnr/spacemacs/pull/12234#issuecomment-524916394).
Ensime's GitHub repositories, including its Emacs integration, are archived.
Meanwhile, Metals has been developed actively, regularly releasing new versions.
It has stabilized significantly, and supports an increasingly full set of
features. Scala 3 is just around the corner, and the community is poised to make
the transition smoothly and relatively quickly. Metals supports it already,
whereas of course Ensime does not and never will. In fact, Scala 2 has had
several import minor versions released since Ensime died. Now that it's 2021,
it's time to cut the baggage we are carrying around for Ensime.
2021-01-11 16:14:01 +00:00
|
|
|
(spell-checking/add-flyspell-hook 'scala-mode))
|
2016-07-16 05:30:56 +00:00
|
|
|
|
2015-10-13 10:39:37 +00:00
|
|
|
(defun scala/init-sbt-mode ()
|
|
|
|
(use-package sbt-mode
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2019-04-26 10:34:11 +00:00
|
|
|
:config
|
[scala] remove long-deprecated Ensime integration
According to its website, the Ensime project has been shut down since 2019. We
have been supporting both Ensime and Metals for [a year and a
half](https://github.com/syl20bnr/spacemacs/pull/12234#issuecomment-524916394).
Ensime's GitHub repositories, including its Emacs integration, are archived.
Meanwhile, Metals has been developed actively, regularly releasing new versions.
It has stabilized significantly, and supports an increasingly full set of
features. Scala 3 is just around the corner, and the community is poised to make
the transition smoothly and relatively quickly. Metals supports it already,
whereas of course Ensime does not and never will. In fact, Scala 2 has had
several import minor versions released since Ensime died. Now that it's 2021,
it's time to cut the baggage we are carrying around for Ensime.
2021-01-11 16:14:01 +00:00
|
|
|
;; WORKAROUND: https://github.com/hvesalai/emacs-sbt-mode/issues/31
|
2019-04-26 10:34:11 +00:00
|
|
|
;; allows for using SPACE in the minibuffer
|
|
|
|
(substitute-key-definition
|
|
|
|
'minibuffer-complete-word
|
|
|
|
'self-insert-command
|
|
|
|
minibuffer-local-completion-map)
|
2019-11-27 10:31:41 +00:00
|
|
|
;; sbt-supershell kills sbt-mode: https://github.com/hvesalai/emacs-sbt-mode/issues/152
|
|
|
|
(setq sbt:program-options '("-Dsbt.supershell=false"))
|
2019-04-26 10:34:11 +00:00
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(spacemacs/declare-prefix-for-mode 'scala-mode "mb" "sbt")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'scala-mode "mg" "goto")
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'scala-mode
|
|
|
|
"b." 'sbt-hydra
|
|
|
|
"bb" 'sbt-command))))
|
2015-04-03 21:35:33 +00:00
|
|
|
|
2016-05-22 01:59:31 +00:00
|
|
|
(defun scala/init-scala-mode ()
|
|
|
|
(use-package scala-mode
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2014-12-29 21:00:07 +00:00
|
|
|
:init
|
2016-08-13 13:43:37 +00:00
|
|
|
(progn
|
|
|
|
(dolist (ext '(".cfe" ".cfs" ".si" ".gen" ".lock"))
|
2016-09-05 02:29:41 +00:00
|
|
|
(add-to-list 'completion-ignored-extensions ext)))
|
2014-12-29 21:00:07 +00:00
|
|
|
:config
|
|
|
|
(progn
|
2015-12-30 15:54:28 +00:00
|
|
|
;; Automatically insert asterisk in a comment when enabled
|
|
|
|
(defun scala/newline-and-indent-with-asterisk ()
|
|
|
|
(interactive)
|
|
|
|
(newline-and-indent)
|
2016-01-04 09:46:22 +00:00
|
|
|
(when scala-auto-insert-asterisk-in-comments
|
2015-12-30 15:54:28 +00:00
|
|
|
(scala-indent:insert-asterisk-on-multiline-comment)))
|
|
|
|
|
|
|
|
(evil-define-key 'insert scala-mode-map
|
|
|
|
(kbd "RET") 'scala/newline-and-indent-with-asterisk)
|
|
|
|
|
2014-12-30 21:53:03 +00:00
|
|
|
(evil-define-key 'normal scala-mode-map "J" 'spacemacs/scala-join-line)
|
|
|
|
|
2021-01-11 18:05:05 +00:00
|
|
|
(pcase scala-sbt-window-position
|
|
|
|
('bottom (setq sbt:display-buffer-action
|
|
|
|
(list #'spacemacs//scala-display-sbt-at-bottom))))
|
|
|
|
|
2014-12-29 21:00:07 +00:00
|
|
|
;; Compatibility with `aggressive-indent'
|
2015-08-08 20:32:36 +00:00
|
|
|
(setq scala-indent:align-forms t
|
|
|
|
scala-indent:align-parameters t
|
2017-02-09 22:22:38 +00:00
|
|
|
scala-indent:default-run-on-strategy
|
|
|
|
scala-indent:operator-strategy))))
|
2016-04-05 04:08:34 +00:00
|
|
|
|
2020-04-03 16:00:45 +00:00
|
|
|
(defun scala/pre-init-dap-mode ()
|
2020-05-16 21:32:30 +00:00
|
|
|
(when (spacemacs//scala-backend-metals-p)
|
|
|
|
(add-to-list 'spacemacs--dap-supported-modes 'scala-mode))
|
2020-04-03 16:00:45 +00:00
|
|
|
(spacemacs//scala-setup-dap))
|
|
|
|
|
2019-09-22 17:52:28 +00:00
|
|
|
(defun scala/post-init-lsp-mode ()
|
|
|
|
(when (spacemacs//scala-backend-metals-p)
|
|
|
|
(spacemacs//scala-setup-metals)))
|
2019-04-26 10:34:11 +00:00
|
|
|
|
2020-06-09 10:22:35 +00:00
|
|
|
(defun scala/init-lsp-metals ()
|
|
|
|
(use-package lsp-metals
|
|
|
|
:defer t
|
|
|
|
:init
|
2020-04-03 16:00:45 +00:00
|
|
|
(spacemacs//scala-setup-treeview)))
|
|
|
|
|
2016-04-05 04:08:34 +00:00
|
|
|
(defun scala/post-init-ggtags ()
|
2020-04-03 16:00:45 +00:00
|
|
|
(when scala-enable-gtags
|
|
|
|
(add-hook 'scala-mode-local-vars-hook #'spacemacs/ggtags-mode-enable)))
|
2016-04-05 04:08:34 +00:00
|
|
|
|
2017-08-26 21:18:09 +00:00
|
|
|
(defun scala/post-init-counsel-gtags ()
|
2020-04-03 16:00:45 +00:00
|
|
|
(when scala-enable-gtags
|
|
|
|
(spacemacs/counsel-gtags-define-keys-for-mode 'scala-mode)))
|
2017-08-26 21:18:09 +00:00
|
|
|
|
2016-04-05 04:08:34 +00:00
|
|
|
(defun scala/post-init-helm-gtags ()
|
2020-04-03 16:00:45 +00:00
|
|
|
(when scala-enable-gtags
|
|
|
|
(spacemacs/helm-gtags-define-keys-for-mode 'scala-mode)))
|