Intellij: Smarter
Intellij: Smarter
C O NT E NT S
052
IntelliJ IDEA
By Andrey Chepstov
ACTION
WINDOWS
OS X
Terminal
Alt+F12
F12
Editor
Esc
Esc
When you need to just focus on the code, try the Distraction
Free Mode. It removes all toolbars, tool windows, and editor
tabs. To switch to this mode, select View Enter Distraction
Free Mode.
An alternative to Distraction Free Mode is hiding all tool
windows by pressing Ctrl+Shift+F12 (Shift+Cmd+F12 for OS
X). Restore the layout to default by using the shortcut again.
U S E R I N T E R FAC E
ENTERPRISE
EXCEL MOBILE
AT
&
INTELLIJ IDEA
WINDOWS
OS X
Project
Alt+1
Changes
Alt+9
Run
Alt+4
Debug
Alt+5
WITH A
DEVELOPMENT
SMARTER IDE
The most intelligent Java IDE
GET IT NOW
A free and open-source version is included www.jetbrains.com/idea
D Z O NE, INC.
DZ O NE .C O M
INTELLIJ IDEA
EDITOR BA SICS
Since in IntelliJ IDEA you can undo refactorings and revert
changes from Local History, it makes no sense to ask you to
save your changes every timeIntelliJ IDEA autosaves your
changes for you.
Editor shortcuts include:
HOT
TIP
CO D E CO M P L E T I O N
Accessing Basic Completion by pressing Ctrl+Space offers
basic suggestions for variables, types, methods, expressions,
and so on. When you call Basic Completion twice, it shows you
more results, including private members and non-imported
static members.
The Smart Completion feature is aware of the expected type
and data flow and offers the option relevant to the context.
To call Smart Completion, press Shift+Ctrl+Space. When
you call Smart completion twice, it shows you more results,
including chains.
WINDOWS
OS X
Shift+Ctrl+Up
Shift+Ctrl+Down
Ctrl+D
Ctrl+Y
Ctrl+/
Shift+Ctrl+/
Alt+F3
Ctrl+R
Next occurrence
F3
Previous occurrence
Shift+F3
Alt+Left
Alt+Right
Navigate back/forward
Ctrl+Alt+Left
Ctrl+Alt+Right
[
]
Ctrl+NumPad+
Ctrl+NumPad-
+
-
ACTION
WINDOWS
OS X
Create new
Ctrl+N
Surround with
Ctrl+Alt+T
Shift+Ctrl+F7
F7
PARAMETER INFO
If you want to see the suggested parameters for any method
or constructor, just press Ctrl+P (Cmd+P for OS X). IntelliJ
IDEA shows parameter info for every overloaded method or
constructor and highlights the best match for the parameters
already typed.
HOT
TIP
D Z O NE, INC .
ACTION
DZ O NE.C O M
INTELLIJ IDEA
SELECT IN
If you need to open the file in a particular tool window (or
Finder/Explorer) you can do it via the Select In action by
pressing Alt+F1.
N AV I G AT I O N
RECENT FILES
Most of the time you work with a certain set of files and need
to switch between them quickly. A real time-saver here is an
action called Recent Files invoked by pressing Ctrl+E (Cmd+E
for OS X). By default, the focus is on the last accessed file. You
can open any tool window through this action.
ACTION
WINDOWS
OS X
Search everywhere
Double Shift
x2
Navigate to class
Ctrl+N
Navigate to file
Ctrl+Shift+N
Navigate to symbol
Ctrl+Shift+Alt+N
Recent files
Ctrl+E
File structure
Ctrl+F12
F12
Select in
Alt+F1
F1
Navigate to declaration
Ctrl+B
Ctrl+H
^H
Ctrl+Alt+U
Q U I C K P O P- U PS
Quick Pop-ups are helpful for checking additional information
related to the symbol at the caret. Here is a list of pop-ups you
should know if you want to be more productive.
D Z O NE, INC .
ACTION
WINDOWS
OS X
Documentation
Ctrl+Q
^J
Quick definition
Shift+Ctrl+I
Space
Show usages
Alt+Ctrl+F7
F7
Show implementation
Ctrl+Alt+B
DZ O NE.C O M
4
Quick Pop-ups are available for symbols in the editor; however,
they are also available for items in any other list via the same
shortcuts.
INSPECTIONS
Inspections are built-in static code analysis tools that help
you find probable bugs, locate dead code, detect performance
issues, and improve the overall code structure.
R E FAC T O R I N G B A S I C S
Most inspections not only tell you where a problem is, but
provide quick fixes to deal with them right away. Press
Alt+Enter to choose a quick-fix.
HOT
TIP
INTELLIJ IDEA
ACTION
WINDOWS
OS X
Rename
Shift+F6
F6
Extract variable
Ctrl+Alt+V
Extract field
Ctrl+Alt+F
Extract constant
Ctrl+Alt+C
Extract method
Ctrl+Alt+M
Extract parameter
Ctrl+Alt+P
Inline
Alt+Ctrl+N
Copy
F5
F5
Move
F6
F6
ACTION
WINDOWS
OS X
Reformat code
Ctrl+Alt+L
Auto-indent lines
Ctrl+Alt+I
^I
Optimize imports
Ctrl+O
^O
Refactor this
Ctrl+Shift+Alt+T
CO D E S T Y L E A N D F O R M AT T I N G
HOT
TIP
FINDING USAGES
Find Usages helps you quickly find all pieces of code
referencing the symbol at the caret (cursor), no matter if
the symbol is a class, method, field, parameter, or another
statement. Just press Alt+F7 to get a list of references grouped
by usage type, module, and file.
V E R S I O N CO N T RO L B A S I C S
To check out a project from a Version Control System (VCS),
click Checkout from Version Control on the Welcome Screen or
in the VCS menu.
D Z O NE, INC .
HOT
TIP
DZ O NE.C O M
INTELLIJ IDEA
RUNNING A ND DEBUGGING
Once youve created a Run/Debug configuration by selecting
Run Edit Configurations, youre able to run and debug
your code.
ACTION
WINDOWS
OS X
Run
Shift+F10
F10
Debug
Shift+F9
F10
Once youve configured the VCS settings, youll see the Version
Control tool window. You can switch to it anytime by pressing
Alt+9 (Cmd+9 for OS X).
The Local Changes tab of the Version Control tool window
shows your local changes, both staged and unstaged.
WINDOWS
OS X
Alt+9
Alt+`
^V
Commit changes
Ctrl+K
Update project
Ctrl+T
Push commits
Ctrl+Shift+K
HOT
TIP
BRANCHES
To perform an operation on a branch, use either Branches from
the main or context menu, the VCS operations popup, or the
widget on the right of the status bar.
WINDOWS
OS X
Toggle breakpoint
Ctrl+F8
F8
Step into
F7
F7
Shift+F7
F7
Step over
F8
F8
Step out
Shift+F8
F8
Resume
F9
Evaluate Expression
Alt+F8
F8
HOT
TIP
Shelves, Stashes, and Patches help you when you need to store
some of the local changes without committing them to the
repository. You can then switch to the repository versions of
the files, and then come back to your changes later.
MAKE
By default, IntelliJ IDEA doesnt automatically compile projects
D Z O NE, INC .
ACTION
DZ O NE.C O M
6
A P P L I C AT I O N S E RV E R S
INTELLIJ IDEA
You can always ask the IDE to build/rebuild your artifacts (once
theyre configured) by selecting Build Build Artifacts
HOT
TIP
CREDITS
G. Ryan Spain
Editor
Yassee Mohebbi
Designer
Chris Smith
Production
Chris Brumfield
Sponsor Relations
Chelsea Bosworth
Marketing
JOIN NOW
DZONE, INC.
150 PRESTON EXECUTIVE DR.
CARY, NC 27513
DZone communities deliver over 6 million pages each month to more than 3.3 million software
developers, architects and decision makers. DZone offers something for everyone, including news,
tutorials, cheat sheets, research guides, feature articles, source code and more.
888.678.0399
919.678.0300
REFCARDZ FEEDBACK WELCOME
[email protected]
Copyright 2015 DZone, Inc. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any
DZONE,
DZONE, INC.
INC.
form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher.
SPONSORSHIP OPPORTUNITIES
DZONE.COM
DZONE.COM
[email protected]
VERSION 1.0
$7.95
EXCEL
ENTERPRISE
MOBILE
DEVELOPMENT
SMARTER
AT
&
WITH A
IDE