aboutsummaryrefslogtreecommitdiffstats
path: root/oni-java.el
diff options
context:
space:
mode:
authorGravatar Tom Willemse2019-10-21 00:41:19 -0700
committerGravatar Tom Willemse2019-10-21 00:42:30 -0700
commitd4e4a25cde3067578be94cdf4e125ecdd2b7770c (patch)
treef0dbfe377acd7e89e0d1c1e6b64c4152aa9d0cac /oni-java.el
parent220ad644dd31cdeb7017a16286f5f95c7063e26c (diff)
downloademacs-config-d4e4a25cde3067578be94cdf4e125ecdd2b7770c.tar.gz
emacs-config-d4e4a25cde3067578be94cdf4e125ecdd2b7770c.zip
Add documentation command for LSP
The default way lsp (at least for Java) is displayed is annoying. I’m used to calling documentation with a keybinding like in Emacs Lisp. This command makes it more like that.
Diffstat (limited to 'oni-java.el')
-rw-r--r--oni-java.el13
1 files changed, 9 insertions, 4 deletions
diff --git a/oni-java.el b/oni-java.el
index e545a24..fb4fe42 100644
--- a/oni-java.el
+++ b/oni-java.el
@@ -4,8 +4,8 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
-;; Version: 2019.1016.231834
-;; Package-Requires: (oni-fci oni-data-dir lsp-java company-lsp lsp-ui hydra)
+;; Version: 2019.1021.002901
+;; Package-Requires: (oni-fci oni-data-dir oni-lsp lsp-java company-lsp hydra)
;; 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
@@ -30,6 +30,7 @@
(require 'hydra)
(require 'lsp-java)
(require 'oni-data-dir)
+(require 'oni-lsp)
(defun oni-java-enable-buffer-formatting ()
"Format the buffer before save."
@@ -50,6 +51,9 @@
("p" lsp-java-create-parameter "Create parameter")
("l" lsp-java-create-local "Create local"))
+(defhydra java-documentation-hydra (:color blue)
+ ("d" oni-lsp-show-doc "Show documentation"))
+
(setq lsp-java-server-install-dir
(oni-data-dir-locate "lsp-java/server/"))
@@ -74,14 +78,15 @@
(add-to-list 'company-backends 'company-lsp)
(define-key java-mode-map (kbd "C-c r") 'java-refactor-hydra/body)
+(define-key java-mode-map (kbd "C-c d") 'java-documentation-hydra/body)
(add-to-list 'auto-insert-alist
'("\\.java\\'"
() "public class "
(file-name-sans-extension
(file-name-nondirectory (buffer-file-name))) " {\n"
- (indent-for-tab-command) _ "\n"
- "}"))
+ (indent-for-tab-command) _ "\n"
+ "}"))
;;;###autoload(with-eval-after-load 'cc-mode (require 'oni-java))