From 61e71803113a3a5f17d39dfcdfbbfec16fc9c82c Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Mon, 22 Apr 2019 01:00:53 -0700 Subject: [PATCH] Add lsp-mode to Java config and stop using JDEE --- oni-java.el | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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))