scala.el 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. ;; --- Scala configuration file ---
  2. ;; Includes:
  3. ;; * Inferred types
  4. ;; * Auto-complete
  5. ;; * Syntax highlighting
  6. ;; * Jump to source/docs
  7. ;; * Refactoring
  8. ;; * Error detection
  9. ;; Requires:
  10. (require 'package-loader)
  11. ;; Enable scala-mode for highlighting, indentation and motion commands
  12. (use-package scala-mode
  13. :mode "\\.s\\(cala\\|bt\\)$")
  14. ;; Enable sbt mode for executing sbt commands
  15. (use-package sbt-mode
  16. :commands sbt-start sbt-command
  17. :config
  18. ;; WORKAROUND: https://github.com/ensime/emacs-sbt-mode/issues/31
  19. ;; allows using SPACE when in the minibuffer
  20. (substitute-key-definition
  21. 'minibuffer-complete-word
  22. 'self-insert-command
  23. minibuffer-local-completion-map)
  24. ;; sbt-supershell kills sbt-mode:
  25. ;; https://github.com/hvesalai/emacs-sbt-mode/issues/152
  26. (setq sbt:program-options '("-Dsbt.supershell=false"))
  27. )
  28. ;; TODO: Maybe make conditional instead of global
  29. ;; Enable nice rendering of diagnostics like compile errors.
  30. (use-package flycheck
  31. :init (global-flycheck-mode))
  32. (use-package lsp-mode
  33. ;; Optional - enable lsp-mode automatically in scala files
  34. :hook (scala-mode . lsp)
  35. (lsp-mode . lsp-lens-mode)
  36. :config (setq lsp-prefer-flymake nil))
  37. ;; Add metals backend for lsp-mode
  38. (use-package lsp-metals)
  39. ;; Enable nice rendering of documentation on hover
  40. (use-package lsp-ui)
  41. ;; lsp-mode supports snippets, but in order for them to work you need to use yasnippet
  42. ;; If you don't want to use snippets set lsp-enable-snippet to nil in your lsp-mode settings
  43. ;; to avoid odd behavior with snippets and indentation
  44. (use-package yasnippet)
  45. ;; Add company-lsp backend for metals
  46. ; [tflucke] 2021-12-20: This isn't in the repos anymore. Also, I don't know why
  47. ; dependancy management won't handle this.
  48. ;(use-package company-lsp)
  49. ;; Use the Debug Adapter Protocol for running tests and debugging
  50. (use-package posframe
  51. ;; Posframe is a pop-up tool that must be manually installed for dap-mode
  52. )
  53. (use-package dap-mode
  54. :hook
  55. (lsp-mode . dap-mode)
  56. (lsp-mode . dap-ui-mode)
  57. )
  58. ;; Use the Tree View Protocol for viewing the project structure and triggering compilation
  59. (use-package lsp-treemacs
  60. :disabled
  61. :config
  62. (lsp-metals-treeview-enable t)
  63. (setq lsp-metals-treeview-show-when-views-received t)
  64. )
  65. (provide 'scala)