[emacs] assimilate meghanada and deps (for Java)
authorAmin Bandali <bandali@gnu.org>
Wed, 31 Oct 2018 15:54:53 +0000 (11:54 -0400)
committerAmin Bandali <bandali@gnu.org>
Wed, 31 Oct 2018 15:54:53 +0000 (11:54 -0400)
also briefly tried lsp-java but meghanada seems to be more stable atm

.gitmodules
init.org
lib/meghanada [new submodule]
lib/yasnippet [new submodule]

index 1a256b3..b31573a 100644 (file)
 [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
 [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
index 790c967..6d0b40f 100644 (file)
--- 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 (submodule)
index 0000000..0b36871
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 0b36871f1537921e1819a84f99f3fb9571831751
diff --git a/lib/yasnippet b/lib/yasnippet
new file mode 160000 (submodule)
index 0000000..1d96da2
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 1d96da2e08664c31ff7f6f7441da1f4fa5680b1f