doomemacs/modules/lang/java/+meghanada.el
Henrik Lissner 6be89e1df6
[breaking] lang/java: rewrite & new submodules #157
Split into two submodules: +eclim & +meghanada. These must be explicitly
included in lang/java's module flags in init.el.
2017-10-03 02:56:02 +02:00

46 lines
1.8 KiB
EmacsLisp

;;; lang/java/+meghanada.el -*- lexical-binding: t; -*-
(def-package! meghanada
:commands meghanada-mode
:config
(setq meghanada-server-install-dir (concat doom-etc-dir "meghanada-server/")
meghanada-use-company (featurep! :completion company)
meghanada-use-flycheck (featurep! :feature syntax-checker)
meghanada-use-eldoc t
meghanada-use-auto-start t)
(add-hook 'java-mode-hook #'(rainbow-delimiters-mode eldoc-mode))
;; Setup on first use
(meghanada-install-server)
(if (file-exists-p (meghanada--locate-server-jar))
(add-hook! 'java-mode-hook #'(meghanada-mode flycheck-mode))
(warn "java-mode: meghanada-server not installed, java-mode will run with reduced functionality"))
(set! :jump 'java-mode
:definition #'meghanada-jump-declaration
:references #'meghanada-reference)
;;
(def-menu! +java/refactor-menu
"Refactoring commands for `java-mode' buffers."
'(("Add imports for unqualified classes" :exec meghanada-import-all)
("Optimize and clean up imports" :exec meghanada-optimize-import)
("Introduce local variable" :exec meghanada-local-variable)
("Format buffer code" :exec meghanada-code-beautify)))
(def-menu! +java/help-menu
"Help and information commands for `java-mode' buffers."
'(("Find usages" :exec meghanada-reference)
("Show type hierarchives and implemented interfaces" :exec meghanada-typeinfo)))
(def-menu! +java/project-menu
"Project commands for `java-mode' buffers."
'(("Compile current file" :exec meghanada-compile-file)
("Compile project" :exec meghanada-compile-project)))
(map! :map java-mode-map
:localleader
:nv "r" #'+java/refactor-menu
:nv "c" #'+java/compile-menu
:nv "p" #'+java/project-menu))