[java] improve binding for lsp-java

This commit is contained in:
Thanh Vuong 2021-06-16 08:30:52 -06:00 committed by Maxi Wolff
parent 9f95c95dfc
commit bb8dd09d3f
3 changed files with 47 additions and 34 deletions

View File

@ -111,40 +111,43 @@ at the root of your project first.
| Key binding | Description |
|---------------+------------------------------------------|
| ~SPC m g g~ | Go to definition |
| ~SPC m g r~ | Find references |
| ~SPC m g R~ | Peek references using ~lsp-ui~ |
| ~SPC m g d~ | Goto type definition |
| ~SPC m g a~ | Search type in project |
| ~SPC m g A~ | Search type in project using ~lsp-ui~ |
| ~SPC m h h~ | Describe thing at point |
| ~SPC m e l~ | List project errors/warnings |
| ~SPC m p u~ | Refresh user settings |
| ~SPC m =~ | Format code |
| ~SPC m c c~ | Build project |
| ~SPC m c p~ | Create spring boot project |
| ~SPC m e a~ | Execute code action |
| ~SPC m e l~ | List project errors/warnings |
| ~SPC m g A~ | Search type in project using ~lsp-ui~ |
| ~SPC m g R~ | Peek references using ~lsp-ui~ |
| ~SPC m g a~ | Search type in project |
| ~SPC m g d~ | Goto type definition |
| ~SPC m g g~ | Go to definition |
| ~SPC m g k k~ | Show type hierarchy |
| ~SPC m g k s~ | Show sub type hierarchy |
| ~SPC m g k u~ | Show super type hierarchy |
| ~SPC m g r~ | Find references |
| ~SPC m h h~ | Describe thing at point |
| ~SPC m q r~ | Restart workspace |
| ~SPC m r o i~ | Organize imports |
| ~SPC m r r~ | Rename symbol |
| ~SPC m r a F~ | Assign statement to field |
| ~SPC m r a a~ | Assign all parameters to fields |
| ~SPC m r a f~ | Assign parameter to field |
| ~SPC m r a i~ | Add import |
| ~SPC m r a l~ | Assign statement to local |
| ~SPC m r a m~ | Add unimplemented methods |
| ~SPC m r c p~ | Create parameter |
| ~SPC m r a t~ | Add throws exception |
| ~SPC m r c f~ | Create field |
| ~SPC m r c i~ | Convert to static import |
| ~SPC m r c p~ | Create parameter |
| ~SPC m r e c~ | Extract constant |
| ~SPC m r e l~ | Extract local |
| ~SPC m r e m~ | Extract method |
| ~SPC m r c i~ | Convert to static import |
| ~SPC m r a t~ | Add throws exception |
| ~SPC m r a a~ | Assign all parameters to fields |
| ~SPC m r a F~ | Assign statement to field |
| ~SPC m r a l~ | Assign statement to local |
| ~SPC m r a f~ | Assign parameter to field |
| ~SPC m r g g~ | Generate getters/setters |
| ~SPC m r g e~ | Generate =equals= and =hashCode= methods |
| ~SPC m r g t~ | Generate =toString= method |
| ~SPC m r g g~ | Generate getters/setters |
| ~SPC m r g o~ | Generate method overrides |
| ~SPC m c c~ | Build project |
| ~SPC m c p~ | Create spring boot project |
| ~SPC m a n~ | Actionable notifications |
| ~SPC m =~ | Format code |
| ~SPC m r g t~ | Generate =toString= method |
| ~SPC m r o i~ | Organize imports |
| ~SPC m r r~ | Rename symbol |
| ~SPC m t b~ | test browser |
| ~SPC m w u~ | Refresh user settings |
*** Debugger
Using the =dap= layer you'll get access to all the DAP key bindings, see the

View File

@ -120,3 +120,13 @@
"Setup LSP Java syntax checking."
(unless (configuration-layer/layer-used-p 'lsp)
(message "`lsp' layer is not installed, please add `lsp' layer to your dotfile.")))
(defun spacemacs/lsp-java-super-type ()
"Show super type hierarchy."
(interactive)
(lsp-java-type-hierarchy 1))
(defun spacemacs/lsp-java-sub-type ()
"Show sub type hierarchy."
(interactive)
(lsp-java-type-hierarchy 0))

View File

@ -154,22 +154,17 @@
:config
(progn
;; key bindings
(dolist (prefix '(("ma" . "actionable")
("mc" . "compile/create")
("mg" . "goto")
("mr" . "refactor")
(dolist (prefix '(("mc" . "compile/create")
("mgk" . "type hierarchy")
("mra" . "add/assign")
("mrc" . "create/convert")
("mrg" . "generate")
("mre" . "extract")
("mp" . "project")
("mq" . "lsp")
("mt" . "test")
("mx" . "execute")))
("mt" . "test")))
(spacemacs/declare-prefix-for-mode
'java-mode (car prefix) (cdr prefix)))
(spacemacs/set-leader-keys-for-major-mode 'java-mode
"pu" 'lsp-java-update-project-configuration
"wu" 'lsp-java-update-project-configuration
;; refactoring
"ro" 'lsp-java-organize-imports
@ -199,7 +194,12 @@
"cc" 'lsp-java-build-project
"cp" 'lsp-java-spring-initializr
"an" 'lsp-java-actionable-notifications))))
"gkk" 'lsp-java-type-hierarchy
"gku" 'spacemacs/lsp-java-super-type
"gks" 'spacemacs/lsp-java-sub-type
;; test
"tb" 'lsp-jt-browser))))
(defun java/init-mvn ()
(use-package mvn