;; --- Scala configuration file --- ;; Includes: ;; * Inferred types ;; * Auto-complete ;; * Syntax highlighting ;; * Jump to source/docs ;; * Refactoring ;; * Error detection ;; Requires: (require 'package-loader) ;; Enable scala-mode for highlighting, indentation and motion commands (use-package scala-mode :mode "\\.s\\(cala\\|bt\\)$") ;; 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")) ) ;; TODO: Maybe make conditional instead of global ;; 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 (setq lsp-prefer-flymake nil)) ;; Add metals backend for lsp-mode (use-package lsp-metals) ;; Enable nice rendering of documentation on hover (use-package lsp-ui) ;; lsp-mode supports snippets, but in order for them to work you need to use yasnippet ;; If you don't want to use snippets set lsp-enable-snippet to nil in your lsp-mode settings ;; to avoid odd behavior with snippets and indentation (use-package yasnippet) ;; Add company-lsp backend for metals ; [tflucke] 2021-12-20: This isn't in the repos anymore. Also, I don't know why ; dependancy management won't handle this. ;(use-package company-lsp) ;; Use the Debug Adapter Protocol for running tests and debugging (use-package posframe ;; Posframe is a pop-up tool that must be manually installed for dap-mode ) (use-package dap-mode :hook (lsp-mode . dap-mode) (lsp-mode . dap-ui-mode) ) ;; Use the Tree View Protocol for viewing the project structure and triggering compilation (use-package lsp-treemacs :disabled :config (lsp-metals-treeview-enable t) (setq lsp-metals-treeview-show-when-views-received t) ) (provide 'scala)