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/funcs.el
Keith Pinson a973da57ee [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-19 21:45:40 +01:00

57 lines
1.8 KiB
EmacsLisp

;;; funcs.el --- Scala Layer functions File for Spacemacs
;;
;; Copyright (c) 2012-2020 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(autoload 'projectile-project-p "projectile")
(defun spacemacs//scala-setup-metals ()
"Setup LSP metals for Scala."
(add-hook 'scala-mode-hook #'lsp))
(defun spacemacs//scala-setup-dap ()
"Setup DAP in metals for Scala."
(when (spacemacs//scala-backend-metals-p)
(add-hook 'scala-mode-hook #'dap-mode)))
(defun spacemacs//scala-display-sbt-at-bottom (buffer args)
"Display a short buffer in a dedicated window at frame bottom.
For use with `sbt:display-buffer-action'."
(set-window-dedicated-p
(display-buffer-at-bottom buffer (cons '(window-height . 12) args))
t))
(defun spacemacs//scala-setup-treeview ()
"Setup lsp-treemacs for Scala."
(setq lsp-metals-treeview-show-when-views-received scala-auto-treeview))
(defun spacemacs//scala-backend-metals-p ()
"Return true if the selected backend is metals"
(eq scala-backend 'scala-metals))
(defun spacemacs/scala-join-line ()
"Adapt `scala-indent:join-line' to behave more like evil's line join.
`scala-indent:join-line' acts like the vanilla `join-line',
joining the current line with the previous one. The vimmy way is
to join the current line with the next.
Try to move to the subsequent line and then join. Then manually move
point to the position of the join."
(interactive)
(let (join-pos)
(save-excursion
(goto-char (line-end-position))
(unless (eobp)
(forward-line)
(call-interactively 'scala-indent:join-line)
(setq join-pos (point))))
(when join-pos
(goto-char join-pos))))