diff --git a/oni-java.el b/oni-java.el index 0714d56..ec5ed7e 100644 --- a/oni-java.el +++ b/oni-java.el @@ -4,8 +4,8 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 20190306003041 -;; Package-Requires: (jdee oni-fci) +;; Version: 20190421175627 +;; Package-Requires: (oni-fci lsp-java company-lsp lsp-ui) ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -26,13 +26,19 @@ ;;; Code: -(require 'jdee) +(with-eval-after-load 'lsp (require 'lsp-java)) + +(defun oni-java-enable-buffer-formatting () + "Format the buffer before save." + (add-hook 'before-save-hook 'lsp-format-buffer nil :local)) (add-hook 'java-mode-hook 'electric-pair-local-mode) (add-hook 'java-mode-hook 'electric-indent-local-mode) (add-hook 'java-mode-hook 'fci-mode) +(add-hook 'java-mode-hook 'lsp) +(add-hook 'java-mode-hook 'oni-java-enable-buffer-formatting) -(setq jdee-server-dir "~/usr/share/java/jdee/") +(add-to-list 'company-backends 'company-lsp) ;;;###autoload(with-eval-after-load 'cc-mode (require 'oni-java))