From: Amin Bandali Date: Wed, 31 Oct 2018 15:54:53 +0000 (-0400) Subject: [emacs] assimilate meghanada and deps (for Java) X-Git-Url: https://git.shemshak.org/~bandali/configs/commitdiff_plain/d3ce35806feebe6094dd922fab6ac39a3b236caf [emacs] assimilate meghanada and deps (for Java) also briefly tried lsp-java but meghanada seems to be more stable atm --- diff --git a/.gitmodules b/.gitmodules index 1a256b3..b31573a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -149,6 +149,9 @@ [submodule "markdown-mode"] path = lib/markdown-mode url = git@github.com:jrblevin/markdown-mode.git +[submodule "meghanada"] + path = lib/meghanada + url = git@github.com:mopemope/meghanada-emacs.git [submodule "memoize"] path = lib/memoize url = git@github.com:skeeto/emacs-memoize.git @@ -264,3 +267,6 @@ [submodule "yaml-mode"] path = lib/yaml-mode url = git@github.com:yoshiki/yaml-mode.git +[submodule "yasnippet"] + path = lib/yasnippet + url = git@github.com:joaotavora/yasnippet.git diff --git a/init.org b/init.org index 790c967..6d0b40f 100644 --- a/init.org +++ b/init.org @@ -1378,6 +1378,70 @@ instead. :mode "\\.nix\\'") #+end_src +** Java + +*** meghanada + +#+begin_src emacs-lisp :tangle yes +(use-package meghanada + :bind + (:map meghanada-mode-map + (("C-M-o" . meghanada-optimize-import) + ("C-M-t" . meghanada-import-all))) + :hook (java-mode . meghanada-mode)) +#+end_src + +*** lsp-java + +#+begin_src emacs-lisp :tangle no +(use-package treemacs) + +(use-package yasnippet + :config + ;; (yas-global-mode) + ) + +(use-package lsp-mode + :init (setq lsp-eldoc-render-all nil + lsp-highlight-symbol-at-point nil) + ) + +(use-package hydra) + +(use-package company-lsp + :after company + :config + (setq company-lsp-cache-candidates t + company-lsp-async t)) + +(use-package lsp-ui + :config + (setq lsp-ui-sideline-update-mode 'point)) + +(use-package lsp-java + :config + (add-hook 'java-mode-hook + (lambda () + (setq-local company-backends (list 'company-lsp)))) + + (add-hook 'java-mode-hook 'lsp-java-enable) + (add-hook 'java-mode-hook 'flycheck-mode) + (add-hook 'java-mode-hook 'company-mode) + (add-hook 'java-mode-hook 'lsp-ui-mode)) + +(use-package dap-mode + :after lsp-mode + :config + (dap-mode t) + (dap-ui-mode t)) + +(use-package dap-java + :after (lsp-java)) + +(use-package lsp-java-treemacs + :after (treemacs)) +#+end_src + * Emacs Enhancements ** [[https://github.com/justbur/emacs-which-key][which-key]] diff --git a/lib/meghanada b/lib/meghanada new file mode 160000 index 0000000..0b36871 --- /dev/null +++ b/lib/meghanada @@ -0,0 +1 @@ +Subproject commit 0b36871f1537921e1819a84f99f3fb9571831751 diff --git a/lib/yasnippet b/lib/yasnippet new file mode 160000 index 0000000..1d96da2 --- /dev/null +++ b/lib/yasnippet @@ -0,0 +1 @@ +Subproject commit 1d96da2e08664c31ff7f6f7441da1f4fa5680b1f