[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.
This commit is contained in:
Henrik Lissner 2017-10-03 00:50:33 +02:00
parent 5219ec2ac7
commit 6be89e1df6
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
4 changed files with 119 additions and 23 deletions

View file

@ -0,0 +1,58 @@
;;; lang/java/+eclim.el -*- lexical-binding: t; -*-
;; NOTE This submodule is incomplete
(def-package! eclim
:init
(add-hook 'java-mode-hook #'eclim-mode)
:config
(set! :jump 'java-mode
:definition #'eclim-java-find-declaration
:references #'eclim-java-find-references
:documentation #'eclim-java-show-documentation-for-current-element)
(require 'eclimd)
(setq help-at-pt-display-when-idle t
help-at-pt-timer-delay 0.1)
(help-at-pt-set-timer)
;;
(def-menu! +java/refactor-menu
"Refactoring commands for `java-mode' buffers."
'(("Generate constructor" :exec eclim-java-constructor)
("Generate getter & setter" :exec eclim-java-generate-getter-and-setter)
("Organize imports" :exec eclim-java-import-organize)
("Reformat" :exec eclim-java-format)
("Rename symbol at point" :exec eclim-java-refactor-rename-symbol-at-point :region nil)))
(def-menu! +java/help-menu
"Help and information commands for `java-mode' buffers."
'(("Find documentation for current element" :exec eclim-java-show-documentation-for-current-element)
("Find references" :exec eclim-java-find-references)
("View call hierarchy" :exec eclim-java-call-hierarchy)
("View hierarchy" :exec eclim-java-hierarchy)
("View problems" :exec eclim-problems)))
(def-menu! +java/project-menu
"Building/compilation commands for `java-mode' buffers."
'(("Build project" :exec eclim-project-build)
("Create project" :exec eclim-project-create)
("Delete project" :exec eclim-project-delete)
("Go to project" :exec eclim-project-goto)
("Import project" :exec eclim-project-import)
("Close project" :exec eclim-project-close)
("Open project" :exec eclim-project-open)
("Update project" :exec eclim-project-update)))
(map! :map java-mode-map
:localleader
:nv "r" #'+java/refactor-menu
:nv "c" #'+java/compile-menu
:nv "p" #'+java/project-menu))
(def-package! company-emacs-eclim
:when (featurep! :completion company)
:after java
:config
(set! :company-backend 'java-mode '(company-emacs-eclim)))

View file

@ -0,0 +1,46 @@
;;; 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))

View file

@ -1,29 +1,14 @@
;;; lang/java/config.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)
(cond ((featurep! +meghanada) (load! +meghanada))
((featurep! +eclim) ; FIXME lang/java +eclim
;;(load! +eclim)
(warn "java-mode: eclim support isn't implemented yet")))
;; 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"))
(add-hook 'java-mode-hook #'(rainbow-delimiters-mode eldoc-mode))
(set! :build 'compile-file 'java-mode #'meghanada-compile-file)
(set! :build 'compile-project 'java-mode #'meghanada-compile-project)
(set! :jump 'java-mode :definition #'meghanada-jump-declaration)
(map! :map meghanada-mode-map :m "gd" #'meghanada-jump-declaration))
;;
;; Common plugins
;;
(def-package! android-mode
:commands android-mode

View file

@ -1,7 +1,14 @@
;; -*- no-byte-compile: t; -*-
;;; lang/java/packages.el
(package! meghanada)
(package! android-mode)
(package! groovy-mode)
(when (featurep! +meghanada)
(package! meghanada))
(when (featurep! +eclim)
(package! eclim)
(when (featurep! :completion company)
(package! company-emacs-eclim)))