doomemacs/modules/lang/java/+meghanada.el
Henrik Lissner ad6a3d0f33
refactor: deprecate featurep! for modulep!
featurep! will be renamed modulep! in the future, so it's been
deprecated. They have identical interfaces, and can be replaced without
issue.

featurep! was never quite the right name for this macro. It implied that
it had some connection to featurep, which it doesn't (only that it was
similar in purpose; still, Doom modules are not features). To undo such
implications and be consistent with its namespace (and since we're
heading into a storm of breaking changes with the v3 release anyway),
now was the best opportunity to begin the transition.
2022-08-14 20:43:35 +02:00

38 lines
1.4 KiB
EmacsLisp

;;; lang/java/+meghanada.el -*- lexical-binding: t; -*-
;;;###if (modulep! +meghanada)
(use-package! meghanada
:hook (java-mode-local-vars . meghanada-mode)
:init
(setq meghanada-server-install-dir (concat doom-etc-dir "meghanada-server/")
meghanada-use-company (modulep! :completion company)
meghanada-use-flycheck (modulep! :checkers syntax)
meghanada-use-eldoc t
meghanada-use-auto-start t)
:config
(set-lookup-handlers! 'java-mode
:definition #'meghanada-jump-declaration
:references #'meghanada-reference)
(defadvice! +java-meghanada-fail-gracefully-a (fn &rest args)
"Toggle `meghanada-mode'. Fail gracefully if java is unavailable."
:around #'meghanada-mode
(if (executable-find meghanada-java-path)
(apply fn args)
(message "Can't find %S binary. Is java installed? Aborting `meghanada-mode'."
meghanada-java-path)))
(map! :localleader
:map java-mode-map
(:prefix ("r" . "refactor")
"ia" #'meghanada-import-all
"io" #'meghanada-optimize-import
"l" #'meghanada-local-variable
"f" #'meghanada-code-beautify)
(:prefix ("h" . "help")
"r" #'meghanada-reference
"t" #'meghanada-typeinfo)
(:prefix ("b" . "build")
"f" #'meghanada-compile-file
"p" #'meghanada-compile-project)))