This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+lang/scala/packages.el

120 lines
3.8 KiB
EmacsLisp
Raw Normal View History

;;; packages.el --- Scala Layer packages File for Spacemacs
;;
2021-03-22 20:11:29 +00:00
;; Copyright (c) 2012-2021 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
(defconst scala-packages
'(
lsp-mode
lsp-metals
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 ()
(spacemacs/enable-flycheck 'scala-mode))
(defun scala/post-init-flyspell ()
(spell-checking/add-flyspell-hook 'scala-mode))
2016-07-16 05:30:56 +00:00
(defun scala/init-sbt-mode ()
(use-package sbt-mode
:defer t
:config
;; WORKAROUND: https://github.com/hvesalai/emacs-sbt-mode/issues/31
;; 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"))
: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
(defun scala/init-scala-mode ()
(use-package scala-mode
: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"))
(add-to-list 'completion-ignored-extensions ext)))
2014-12-29 21:00:07 +00:00
:config
(progn
;; Automatically insert asterisk in a comment when enabled
(defun scala/newline-and-indent-with-asterisk ()
(interactive)
(newline-and-indent)
(when scala-auto-insert-asterisk-in-comments
(scala-indent:insert-asterisk-on-multiline-comment)))
(evil-define-key 'insert scala-mode-map
(kbd "RET") 'scala/newline-and-indent-with-asterisk)
(evil-define-key 'normal scala-mode-map "J" 'spacemacs/scala-join-line)
(when (eq 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'
(setq scala-indent:align-forms t
scala-indent:align-parameters t
scala-indent:default-run-on-strategy
scala-indent:operator-strategy))))
(defun scala/pre-init-dap-mode ()
(when (spacemacs//scala-backend-metals-p)
(add-to-list 'spacemacs--dap-supported-modes 'scala-mode))
(spacemacs//scala-setup-dap))
(defun scala/post-init-lsp-mode ()
(when (spacemacs//scala-backend-metals-p)
(spacemacs//scala-setup-metals)))
(defun scala/init-lsp-metals ()
(use-package lsp-metals
:defer t
:init
(spacemacs//scala-setup-treeview)))
(defun scala/post-init-ggtags ()
(when scala-enable-gtags
(add-hook 'scala-mode-local-vars-hook #'spacemacs/ggtags-mode-enable)))
(defun scala/post-init-counsel-gtags ()
(when scala-enable-gtags
(spacemacs/counsel-gtags-define-keys-for-mode 'scala-mode)))
(defun scala/post-init-helm-gtags ()
(when scala-enable-gtags
(spacemacs/helm-gtags-define-keys-for-mode 'scala-mode)))