2015-12-02 14:23:39 +00:00
#+TITLE : Java layer
2015-07-04 04:55:38 +00:00
2015-07-04 05:44:50 +00:00
[[file:img/java.png ]]
2018-09-19 03:54:47 +00:00
* Table of Contents :TOC_4_gh:noexport:
2017-05-22 14:16:12 +00:00
- [[#description ][Description ]]
2017-11-29 19:47:06 +00:00
- [[#features ][Features: ]]
2017-05-22 14:16:12 +00:00
- [[#layer-installation ][Layer Installation ]]
- [[#layer ][Layer ]]
- [[#choosing-a-backend ][Choosing a backend ]]
- [[#backends ][Backends ]]
- [[#meghanada ][Meghanada ]]
- [[#installation ][Installation ]]
- [[#about-maven ][About Maven ]]
- [[#eclim ][Eclim ]]
- [[#installation-1 ][Installation ]]
- [[#eclipse ][Eclipse ]]
- [[#eclim-1 ][Eclim ]]
- [[#configuration ][Configuration ]]
- [[#usage ][Usage ]]
- [[#ensime ][ENSIME ]]
2017-11-28 11:57:02 +00:00
- [[#installation-when-using-sbt ][Installation when using SBT ]]
- [[#installation-when-using-gradle ][Installation when using Gradle ]]
2017-05-22 14:16:12 +00:00
- [[#configuration-1 ][Configuration ]]
- [[#usage-1 ][Usage ]]
- [[#issues ][Issues ]]
2018-08-21 18:47:48 +00:00
- [[#lsp-java ][LSP Java ]]
2018-10-21 07:44:21 +00:00
- [[#usage-2 ][Usage ]]
2017-05-22 14:16:12 +00:00
- [[#key-bindings ][Key bindings ]]
- [[#meghanada-1 ][Meghanada ]]
- [[#server ][Server ]]
- [[#navigation ][Navigation ]]
- [[#compilation ][Compilation ]]
- [[#tests-junit ][Tests (junit) ]]
- [[#refactoring ][Refactoring ]]
- [[#tasks ][Tasks ]]
- [[#eclim-2 ][Eclim ]]
- [[#java-mode ][Java-mode ]]
2017-07-08 22:11:52 +00:00
- [[#ant ][Ant ]]
2017-05-22 14:16:12 +00:00
- [[#project-management ][Project management ]]
- [[#eclim-daemon ][Eclim daemon ]]
- [[#goto ][Goto ]]
- [[#refactoring-1 ][Refactoring ]]
- [[#documentation-find ][Documentation, Find ]]
- [[#errors-problems ][Errors (problems) ]]
- [[#tests ][Tests ]]
- [[#errors-problems-buffer ][Errors (problems) buffer ]]
- [[#projects-buffer ][Projects buffer ]]
- [[#ensime-key-bindings ][Ensime key bindings ]]
- [[#search ][Search ]]
- [[#ensime-search-mode ][Ensime Search Mode ]]
- [[#sbt ][sbt ]]
- [[#typecheck ][Typecheck ]]
- [[#debug ][Debug ]]
- [[#errors ][Errors ]]
- [[#goto-1 ][Goto ]]
- [[#print-and-yank-types ][Print and yank types ]]
- [[#documentation-inspect ][Documentation, Inspect ]]
- [[#server-1 ][Server ]]
- [[#refactoring-2 ][Refactoring ]]
- [[#tests-1 ][Tests ]]
- [[#repl ][REPL ]]
2018-08-21 18:47:48 +00:00
- [[#lsp-java-1 ][LSP Java ]]
2018-11-25 16:50:46 +00:00
- [[#code-intelligence-shorcuts ][Code intelligence shorcuts ]]
- [[#debugger-shorcuts ][Debugger shorcuts ]]
2017-12-17 23:39:55 +00:00
- [[#maven ][Maven ]]
- [[#gradle ][Gradle ]]
2015-07-04 04:55:38 +00:00
* Description
2017-11-29 19:47:06 +00:00
This layer adds support for the Java language.
** Features:
- Support for the following backends:
- [[https://github.com/mopemope/meghanada-emacs ][Meghanada ]] client/server (default),
- [[http://eclim.org ][Eclim ]] client/server,
- [[https://ensime.github.io/ ][ENSIME ]] client/server.
2018-08-21 18:47:48 +00:00
- [[https://github.com/emacs-lsp/lsp-java ][LSP Java ]] client/server.
2017-11-29 19:47:06 +00:00
- Each provides:
- Auto-completion using company
- Linting using flycheck integration
- Maven and Gradle integration
2015-07-04 04:55:38 +00:00
* Layer Installation
** Layer
2016-01-06 05:21:55 +00:00
To use this configuration layer, add it to your =~/.spacemacs= . You will need to
add =java= to the existing =dotspacemacs-configuration-layers= list in this
2017-02-09 22:22:38 +00:00
file.
2017-03-19 17:15:33 +00:00
** Choosing a backend
2017-02-09 22:22:38 +00:00
To choose a default backend set the layer variable =java-backend= :
#+BEGIN_SRC elisp
2018-09-19 03:54:47 +00:00
(java :variables java-backend 'eclim)
2016-11-14 22:09:54 +00:00
#+END_SRC
2015-07-04 04:55:38 +00:00
2017-02-09 22:22:38 +00:00
Backend can be chosen on a per project basis using directory local variables
(files named =.dir-locals.el= at the root of a project), an example to use the
2017-03-19 17:15:33 +00:00
=eclim= backend:
2017-02-09 22:22:38 +00:00
#+BEGIN_SRC elisp
2018-09-19 03:54:47 +00:00
;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")
2017-02-09 22:22:38 +00:00
2018-09-19 03:54:47 +00:00
((java-mode (java-backend . eclim)))
2017-02-09 22:22:38 +00:00
#+END_SRC
*Note:* you can easily add a directory local variable with ~SPC f v d~ .
2016-11-22 04:18:03 +00:00
If you want to use the Ensime backend, you should modify your =~/.spacemacs= to
use the recommended Ensime version (Stable). Please add the following lines to
=dotspacemacs/user-init= :
2018-07-10 10:57:25 +00:00
2016-11-22 04:18:03 +00:00
#+BEGIN_SRC emacs-lisp
2018-06-01 06:59:57 +00:00
(add-to-list 'configuration-layer-elpa-archives '("melpa-stable" . "stable.melpa.org/packages/ "))
(add-to-list 'package-pinned-packages '(ensime . "melpa-stable"))
2016-11-22 04:18:03 +00:00
#+END_SRC
2017-03-19 17:15:33 +00:00
* Backends
** Meghanada
Meghanada is composed of a lightweight server and an Emacs minor mode. It
is unintrusive and integrates with =company= and =flycheck= .
Both =Gradle= and =Maven= projects are compatible with Meghanada.
Meghanada is the default backend used by this layer, see [[#choosing-a-backend ][Choosing a backend ]] in
order to lean how to select a different backend.
*** Installation
The Meghanada server will be installed automatically whenever a Java file
is opened.
If you get issues with the auto-installation you can either download the last
version of the server manually [[https://dl.bintray.com/mopemope/meghanada/ ][there ]] or build from source hosted on [[https://github.com/mopemope/meghanada-server][the GitHub
repository]] and copy the =jar= file to =.emacs.d/.cache/meghanada= folder.
No additional configuration is necessary!
*** About Maven
Maven is not fully supported by Meghanada (but should still work fine for most
projects). If you encounter disconnection from the server then run =mvn install=
at the root of your project first.
2015-07-04 04:55:38 +00:00
** Eclim
Eclim provides the ability to access Eclipse features such as code completion,
2017-11-29 19:47:06 +00:00
searching, code validation, and many more.
2015-07-04 04:55:38 +00:00
2017-02-09 22:22:38 +00:00
*** Installation
**** Eclipse
First you need the last version of Eclispe from the [[https://www.eclipse.org/downloads/eclipse-packages/ ][official Eclipse site ]].
2015-07-04 04:55:38 +00:00
2017-02-09 22:22:38 +00:00
*Note:* if you are on MacOS there some issues between the new native Eclipse
application installed by the =Eclispe-install.app= wizard and the Eclim
installer wizard. The recommended way to install Eclipse on MacOS is by using
=homebrew= or by get the =tar.gz= compressed file instead. With homebrew
the command line to install Eclipse is =brew cask install eclipse-jee= .
2015-07-04 04:55:38 +00:00
2017-02-09 22:22:38 +00:00
**** Eclim
For installation of Eclim check the [[http://eclim.org/install.html#download ][official page ]] to download the installer
then double click on it or launch it in the command line with the following
command (the example is for MacOS, replace the eclispe.home definition by
your correct location as well as the current version of eclim):
2016-08-03 21:53:00 +00:00
2017-02-09 22:22:38 +00:00
#+BEGIN_SRC shell
2018-09-19 03:54:47 +00:00
$ java -Dvim.skip=true -Declipse.home= /Applications/Eclipse.app/Contents/Eclipse -jar eclim_2.6.0.jar install
2016-08-03 21:53:00 +00:00
#+END_SRC
2017-02-09 22:22:38 +00:00
*** Configuration
You may need to set the Eclipse and Eclim paths in your dotfile as layer
variables or in the =dotspacemacs/user-config= , for instance on MacOS as layer
variables:
2018-09-19 03:54:47 +00:00
#+BEGIN_SRC elisp
(java :variables java-backend 'eclim
eclim-eclipse-dirs '("/Applications/Eclipse.app/Contents/Eclipse/ ")
eclim-executable "/Applications/Eclipse.app/Contents/Eclipse/eclim")
#+END_SRC
2017-02-09 22:22:38 +00:00
You can also configure useful other options like the default location for the
Eclim workspace (default value is =~/workspace= ), as shown below:
2018-09-19 03:54:47 +00:00
#+BEGIN_SRC elisp
(setq
;; Specify the workspace to use by default
eclimd-default-workspace "/path/to/default/eclipse/workspace"
;; whether autostarting eclimd or not (default nil)
eclimd-autostart t
;; Whether or not to block emacs until eclimd is ready (default nil)
eclimd-wait-for-process t)
#+END_SRC
2017-02-09 22:22:38 +00:00
2015-07-04 04:55:38 +00:00
*** Usage
2017-02-09 22:22:38 +00:00
Start the eclim daemon with ~SPC m D s~ and stop it with ~SPC m D k~ . (See
2016-08-05 19:18:32 +00:00
below.)
2015-07-04 04:55:38 +00:00
2017-05-15 22:00:43 +00:00
Syntax checking is performed only on demand with ~SPC e e~ to preserve
2017-02-15 04:22:29 +00:00
perfomance.
Auto-save feature may freeze Emacs sometimes, use ~C-g~ to unfreeze Emacs or
atlernatively you can set =dotspacemacs-auto-save-file-location= to nil.
2017-02-09 22:22:38 +00:00
** ENSIME
Another backend option is the ENSIME server, which is a lot more responsive than
Eclim. ENSIME is originally made to work with Scala but it now works with plain
2017-03-21 06:47:31 +00:00
Java projects as well.
2016-11-14 22:09:54 +00:00
2017-11-28 11:57:02 +00:00
*** Installation when using SBT
2016-11-14 22:09:54 +00:00
Find it with your favourite package manager, eg:
2018-07-10 10:57:25 +00:00
2016-11-14 22:09:54 +00:00
#+BEGIN_SRC shell
nix-env --install sbt
#+END_SRC
2018-07-10 10:57:25 +00:00
2016-11-14 22:09:54 +00:00
or refer to [[http://www.scala-sbt.org/download.html ][the sbt installation instructions ]].
2017-11-28 11:57:02 +00:00
*** Installation when using Gradle
2018-02-28 02:53:04 +00:00
Refer to the [[https://ensime.github.io/build_tools/gradle/ ][Ensime installation instructions ]] to install the =ensime-gradle=
2017-11-28 11:57:02 +00:00
plugin.
2017-03-21 06:47:31 +00:00
*** Configuration
Follow [[https://ensime.github.io/build_tools/sbt/ ][the ENSIME configuration instructions ]]. Spacemacs uses
the development version of Ensime so follow the appropriate steps.
2016-11-14 22:09:54 +00:00
To use the build functions under ~SPC m b~ you need to use version =0.13.5= or
2018-09-19 03:54:47 +00:00
newer of =sbt= , and specify that in your project’ s =project/build.properties= .
2016-11-14 22:09:54 +00:00
For example,
2018-07-10 10:57:25 +00:00
2016-11-14 22:09:54 +00:00
#+BEGIN_SRC scala
sbt.version=0.13.11
#+END_SRC
*** Usage
2017-03-21 06:47:31 +00:00
~SPC SPC spacemacs/ensime-gen-and-restart~ or ~SPC m D r~ generates a new config
for a project and starts the server. Afterwards ~SPC SPC ensime~ or ~SPC m D s~
will suffice do the trick.
2017-02-09 22:22:38 +00:00
2016-11-14 22:09:54 +00:00
*** Issues
2017-02-09 22:22:38 +00:00
ENSIME is originally built for Scala, so support for java is not complete, in
2018-09-19 03:54:47 +00:00
particular refactoring doesn’ t work.
2016-11-14 22:09:54 +00:00
2018-08-21 18:47:48 +00:00
** LSP Java
2018-11-08 20:21:30 +00:00
LSP Java is the Java adapter for [[https://github.com/emacs-lsp/lsp-mode ][LSP Mode ]] which is the Emacs client for [[https://github.com/Microsoft/language-server-protocol ][Language Server Protocol ]].
2018-08-21 18:47:48 +00:00
2018-10-21 07:44:21 +00:00
*** Usage
2018-11-08 20:21:30 +00:00
Open a java file and the ~lsp-java~ will automatically download the server
and ask you which projects you want to import.
2018-08-21 18:47:48 +00:00
2017-03-19 17:15:33 +00:00
* Key bindings
2017-02-09 22:22:38 +00:00
** Meghanada
2017-03-19 17:15:33 +00:00
*** Server
2017-02-09 22:22:38 +00:00
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2018-09-19 03:54:47 +00:00
|-------------+----------------------------------------------|
| ~SPC m D c~ | Connect to server |
| ~SPC m D d~ | Disconnect from server |
| ~SPC m D i~ | Install server (should be done automatically |
| ~SPC m D k~ | Kill server |
| ~SPC m D l~ | Clear server cache |
| ~SPC m D p~ | Ping server |
| ~SPC m D r~ | Restart server |
| ~SPC m D s~ | Start server |
| ~SPC m D u~ | Update server |
| ~SPC m D v~ | Print version of the server |
2017-02-09 22:22:38 +00:00
2017-03-19 17:15:33 +00:00
*** Navigation
2017-02-09 22:22:38 +00:00
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2018-09-19 03:54:47 +00:00
|-------------+--------------------------------|
| ~SPC m g b~ | Jump back to previous location |
| ~SPC m g g~ | Jump to declaration |
2017-02-09 22:22:38 +00:00
2017-03-19 17:15:33 +00:00
*** Compilation
2017-02-09 22:22:38 +00:00
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2018-09-19 03:54:47 +00:00
|-------------+-----------------------|
| ~SPC m c b~ | Compile file (buffer) |
| ~SPC m c c~ | Compile project |
2017-03-19 17:15:33 +00:00
*** Tests (junit)
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2018-09-19 03:54:47 +00:00
|-------------+-----------------------------|
| ~SPC m t a~ | Run all tests |
| ~SPC m t c~ | Run test class around point |
| ~SPC m t l~ | Run last tests |
| ~SPC m t t~ | Run test cause around point |
2017-03-19 17:15:33 +00:00
*** Refactoring
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2018-09-19 03:54:47 +00:00
|-------------+----------------------------------------|
| ~SPC m =~ | Beautify code |
| ~SPC m r i~ | Optimize imports |
| ~SPC m r I~ | Import all |
| ~SPC m r n~ | Create a new class, interface, or enum |
2017-03-19 17:15:33 +00:00
*** Tasks
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2018-09-19 03:54:47 +00:00
|-------------+-------------|
| ~SPC m x :~ | Run task |
2017-02-09 22:22:38 +00:00
** Eclim
*** Java-mode
2017-07-08 22:11:52 +00:00
**** Ant
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2018-09-19 03:54:47 +00:00
|-------------+-----------------|
| ~SPC m a a~ | Run Ant |
| ~SPC m a c~ | Clear Ant cache |
| ~SPC m a r~ | Run Ant |
| ~SPC m a v~ | Validate |
2017-07-08 22:11:52 +00:00
2017-02-09 22:22:38 +00:00
**** Project management
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2018-09-19 03:54:47 +00:00
|-------------+--------------------------------|
| ~SPC m p b~ | Build project |
| ~SPC m p c~ | Create project |
| ~SPC m p d~ | Delete project |
| ~SPC m p g~ | Open file in current project |
| ~SPC m p i~ | Import project |
| ~SPC m p j~ | Information about project |
| ~SPC m p k~ | Close project |
| ~SPC m p o~ | Open project |
| ~SPC m p p~ | Open project management buffer |
| ~SPC m p r~ | Run project |
| ~SPC m p u~ | Update project |
2017-02-09 22:22:38 +00:00
**** Eclim daemon
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2018-09-19 03:54:47 +00:00
|-------------+--------------|
| ~SPC m D k~ | Kill daemon |
| ~SPC m D s~ | Start daemon |
2017-02-09 22:22:38 +00:00
**** Goto
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2018-09-19 03:54:47 +00:00
|-------------+---------------------------------------------|
| ~M- , ~ | jump back from go to declaration/definition |
| ~SPC m g g~ | go to declaration |
| ~SPC m g t~ | go to type definition |
2017-02-09 22:22:38 +00:00
**** Refactoring
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2018-09-19 03:54:47 +00:00
|-------------+----------------------------------------|
| ~SPC m r c~ | create a constructor |
| ~SPC m r f~ | format file |
| ~SPC m r g~ | generate getter and setter |
| ~SPC m r i~ | optimize imports |
| ~SPC m r j~ | implement or override a method |
| ~SPC m r n~ | create a new class, enum, or interface |
| ~SPC m r r~ | rename symbol |
2017-02-09 22:22:38 +00:00
**** Documentation, Find
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2018-09-19 03:54:47 +00:00
|-------------+----------------------------------------|
| ~SPC m f f~ | general find in project |
| ~SPC m h c~ | call hierarchy |
| ~SPC m h h~ | show documentation for symbol at point |
| ~SPC m h i~ | view hierarchy |
| ~SPC m h u~ | show usages for symbol at point |
2017-02-09 22:22:38 +00:00
**** Errors (problems)
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2018-09-19 03:54:47 +00:00
|-------------+----------------------------|
| ~SPC e e~ | Force an error check |
| ~SPC e l~ | List errors |
| ~SPC e n~ | Next error |
| ~SPC e p~ | Previous error |
| ~SPC m e e~ | Correct error around point |
2017-02-09 22:22:38 +00:00
**** Tests
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2018-09-19 03:54:47 +00:00
|-------------+---------------------------------------------------------------|
| ~SPC m t t~ | run JUnit tests for current method or current file or project |
2017-02-09 22:22:38 +00:00
*** Errors (problems) buffer
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2018-09-19 03:54:47 +00:00
|-------------+-------------------------------------|
| ~RET~ | go to problem place |
| ~a~ | show all problems |
| ~e~ | show only errors |
| ~f~ | show problems only for current file |
| ~g~ | refresh problems |
| ~q~ | quit |
| ~w~ | show only warnings |
2017-02-09 22:22:38 +00:00
*** Projects buffer
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2018-09-19 03:54:47 +00:00
|-------------+--------------------------------------------|
| ~RET~ | go to current project |
| ~c~ | go to problem place |
| ~D~ | delete project |
| ~g~ | refresh buffer |
| ~i~ | info about current project |
| ~I~ | import existing project into the workspace |
| ~m~ | mark current project |
| ~M~ | mark all projects |
| ~N~ | create new project |
| ~o~ | open project |
| ~p~ | update project |
| ~q~ | quit |
| ~R~ | rename current project |
| ~u~ | unmark current project |
| ~U~ | unmark all projects |
2016-04-13 03:31:38 +00:00
2017-04-17 23:35:50 +00:00
** Ensime key bindings
2017-02-09 22:22:38 +00:00
*** Search
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2017-02-09 22:22:38 +00:00
|-------------+-----------------------------------------------------|
| ~SPC m /~ | incremental search using =ensime-scalex= major mode |
| ~SPC m ?~ | incremental search in all live buffers |
2017-04-18 17:01:19 +00:00
*** Ensime Search Mode
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2017-04-18 17:01:19 +00:00
|-------------+-------------------------------------------------------------------|
| ~C-j~ | Move to next match |
| ~C-k~ | Move to previous match |
| ~C-i~ | Insert at point import of current result |
| ~RET~ | Jump to the target of the currently selected ensime-search-result |
2017-05-15 02:56:42 +00:00
| ~C-q~ | Quit ensime search |
2017-04-18 17:01:19 +00:00
2017-02-09 22:22:38 +00:00
*** sbt
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2017-02-09 22:22:38 +00:00
|-------------+---------------------|
| ~SPC m b .~ | sbt transient state |
| ~SPC m b b~ | sbt command |
| ~SPC m b c~ | compile |
| ~SPC m b C~ | clean command |
| ~SPC m b i~ | switch to sbt shell |
| ~SPC m b p~ | package command |
| ~SPC m b r~ | run command |
*** Typecheck
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2018-07-09 19:47:21 +00:00
|-------------+-----------------------------|
| ~SPC m c t~ | type check the current file |
2017-02-09 22:22:38 +00:00
*** Debug
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2017-02-09 22:22:38 +00:00
|-------------+-----------------------------|
| ~SPC m d A~ | Attach to a remote debugger |
| ~SPC m d b~ | set breakpoint |
| ~SPC m d B~ | clear breakpoint |
| ~SPC m d C~ | clear all breakpoints |
| ~SPC m d c~ | continue |
| ~SPC m d i~ | inspect value at point |
| ~SPC m d n~ | next |
| ~SPC m d o~ | step out |
| ~SPC m d q~ | quit |
| ~SPC m d r~ | run |
| ~SPC m d s~ | step |
| ~SPC m d t~ | backtrace |
*Note:* These key bindings need a transient-state, PR welcome :-)
*** Errors
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2017-02-09 22:22:38 +00:00
|-------------+----------------------------------------------------|
| ~SPC m e e~ | print error at point |
| ~SPC m e s~ | switch to buffer containing the stack trace parser |
2015-07-04 04:55:38 +00:00
*** Goto
2016-04-13 03:31:38 +00:00
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2018-07-09 19:47:21 +00:00
|-------------+------------------|
| ~SPC m g g~ | go to definition |
2015-07-04 04:55:38 +00:00
2017-02-09 22:22:38 +00:00
*** Print and yank types
2017-04-25 15:42:58 +00:00
2017-02-09 22:22:38 +00:00
|-------------+--------------------------------|
| ~SPC m h T~ | print full type name at point |
| ~SPC m h t~ | print short type name at point |
| ~SPC m y T~ | yank full type name at point |
| ~SPC m y t~ | yank short type name at point |
2015-07-04 04:55:38 +00:00
2017-02-09 22:22:38 +00:00
*** Documentation, Inspect
2016-04-13 03:31:38 +00:00
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2015-07-04 04:55:38 +00:00
|-------------+----------------------------------------|
| ~SPC m h h~ | show documentation for symbol at point |
2017-02-09 22:22:38 +00:00
| ~SPC m h u~ | show uses for symbol at point |
*** Server
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2017-02-09 22:22:38 +00:00
|-------------+--------------------------------------------------------|
| ~SPC m D f~ | reload open files |
| ~SPC m D r~ | regenerate the =.ensime= and restart the ensime server |
| ~SPC m D s~ | start ensime server |
*** Refactoring
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2017-02-09 22:22:38 +00:00
|-------------+----------------------------------------------------------------------|
| ~SPC m r a~ | add type annotation |
| ~SPC m r d~ | get rid of an intermediate variable (=ensime-refactor-inline-local=) |
| ~SPC m r D~ | get rid of an intermediate variable (=ensime-undo-peek=) |
| ~SPC m r i~ | organize imports |
| ~SPC m r m~ | extract a range of code into a method |
| ~SPC m r r~ | rename a symbol project wide |
| ~SPC m r t~ | import type at point |
| ~SPC m r v~ | extract a range of code into a variable |
| ~SPC m z~ | expand/contract region |
2015-07-04 04:55:38 +00:00
*** Tests
2016-04-13 03:31:38 +00:00
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2017-02-09 22:22:38 +00:00
|-------------+--------------------------|
| ~SPC m t a~ | test command (sbt) |
| ~SPC m t r~ | test quick command (sbt) |
| ~SPC m t t~ | test only (sbt) |
*** REPL
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2017-02-09 22:22:38 +00:00
|-------------+---------------------------------------------------------------------|
| ~SPC m s a~ | ask for a file to be loaded in the REPL |
| ~SPC m s b~ | send buffer to the REPL |
| ~SPC m s B~ | send buffer to the REPL and focus the REPL buffer in =insert state= |
| ~SPC m s i~ | start or switch to the REPL inferior process |
| ~SPC m s r~ | send region to the REPL |
| ~SPC m s R~ | send region to the REPL and focus the REPL buffer in =insert state= |
2017-12-17 23:39:55 +00:00
2018-08-21 18:47:48 +00:00
** LSP Java
2018-11-25 16:50:46 +00:00
*** Code intelligence shorcuts
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2018-08-21 18:47:48 +00:00
|---------------+---------------------------------------|
| ~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 e a~ | Execute code action |
| ~SPC m q r~ | Restart workspace |
| ~SPC m r o i~ | Organize imports |
| ~SPC m r r~ | Rename symbol |
| ~SPC m r a i~ | Add import |
| ~SPC m r a m~ | Add unimplemented methods |
| ~SPC m r c p~ | Create parameter |
| ~SPC m r c f~ | Create field |
| ~SPC m r e c~ | Extract constant |
| ~SPC m r e l~ | Extract local |
| ~SPC m r e m~ | Extract method |
| ~SPC m c c~ | Build project |
| ~SPC m a n~ | Actionable notifications |
| ~SPC m =~ | Format code |
2018-12-05 03:03:03 +00:00
2018-11-25 16:50:46 +00:00
*** Debugger shorcuts
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2018-11-25 16:50:46 +00:00
|---------------+---------------------------------|
| ~SPC m d t t~ | Debug test method |
| ~SPC m d t c~ | Debug test class |
| ~SPC m d j~ | Debug java class(main method). |
|---------------+---------------------------------|
| ~SPC m t t~ | Run test method |
| ~SPC m t c~ | Run test class |
|---------------+---------------------------------|
| ~SPC m d d d~ | start debugging |
| ~SPC m d d l~ | debug last configuration |
| ~SPC m d d r~ | debug recent configuration |
|---------------+---------------------------------|
| ~SPC m d c~ | continue |
| ~SPC m d i~ | step in |
| ~SPC m d o~ | step out |
| ~SPC m d s~ | next step |
| ~SPC m d v~ | inspect value at point |
| ~SPC m d r~ | restart frame |
|---------------+---------------------------------|
| ~SPC m d .~ | debug transient state |
|---------------+---------------------------------|
| ~SPC m d a~ | abandon current session |
| ~SPC m d A~ | abandon all process |
|---------------+---------------------------------|
| ~SPC m d e e~ | eval |
| ~SPC m d e r~ | eval region |
| ~SPC m d e t~ | eval value at point |
|---------------+---------------------------------|
| ~SPC m d S s~ | switch session |
| ~SPC m d S t~ | switch thread |
| ~SPC m d S f~ | switch frame |
|---------------+---------------------------------|
| ~SPC m d I i~ | inspect |
| ~SPC m d I r~ | inspect region |
| ~SPC m d I t~ | inspect value at point |
|---------------+---------------------------------|
| ~SPC m d b b~ | toggle a breakpoint |
| ~SPC m d b c~ | change breakpoint condition |
| ~SPC m d b l~ | change breakpoint log condition |
| ~SPC m d b h~ | change breakpoint hit count |
| ~SPC m d b a~ | add a breakpoint |
| ~SPC m d b d~ | delete a breakpoint |
| ~SPC m d b D~ | clear all breakpoints |
|---------------+---------------------------------|
| ~SPC m d '_~ | Run debug REPL |
|---------------+---------------------------------|
| ~SPC m d w l~ | list local variables |
| ~SPC m d w o~ | goto output buffer if present |
| ~SPC m d w s~ | list sessions |
| ~SPC m d w b~ | list breakpoints |
2018-12-05 03:03:03 +00:00
2017-12-17 23:39:55 +00:00
** Maven
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2017-12-17 23:39:55 +00:00
|-----------------+------------------------------------------------------|
| ~SPC m m c c~ | Compile |
| ~SPC m m c C~ | Clean |
| ~SPC m m c r~ | Clean and compile |
| ~SPC m m g a~ | Switch between class and test file |
| ~SPC m m g A~ | Switch between class and test file in another window |
| ~SPC m m t a~ | Run all tests |
| ~SPC m m t C-a~ | Clean and run all tests |
| ~SPC m m t b~ | Run current buffer tests |
| ~SPC m m t i~ | Test and install |
| ~SPC m m t t~ | Run a specific test |
** Gradle
2018-12-05 03:03:03 +00:00
| Key binding | Description |
2017-12-17 23:39:55 +00:00
|---------------+--------------------------|
| ~SPC m l c c~ | Compile |
| ~SPC m l c C~ | Clean |
| ~SPC m l c r~ | Clean and compile |
| ~SPC m l t a~ | Run all tests |
| ~SPC m l t b~ | Run current buffer tests |
| ~SPC m l t t~ | Run a specific test |
| ~SPC m l x~ | Execute a Gradle task |