IntelliJ Productivity Tips
Agenda
-
How to use this guide
- Navigation
- Code Insights
- Version Control
- Editing
- Useful editor settings
How to use this guide
- Instead of specific shortcuts I'll list the canonical action name (except for this slide)
- You can lookup the action using "Main menu > Help > Find action" (cmd+shift+a / ctrl+shift+a)
- You can directly assign a shortcut for an action in the search by hitting (alt+enter)
- Searching in both directions and full configuration is in the settings under "keymap"
Navigation
What it does
Main menu > Navigate > Symbol...
Quick way to go to a specific unique identifier directly
(e.g. all graphql-types in the graphql-service like "UserType")
Why should you use it
Searches for symbols (e.g. variables and methods) in the project
Navigation
What it does
Main menu > Navigate > Line/Column...
Quick way to get to the code mentioned in a compiler/exception error message
(Note: You can also append something like ":50" to any search to instantly jump to the line in the search result)
Why should you use it
Jumps to specified line (and optionally column) in the current document
Navigation
What it does
Main menu > Navigate > Next Highlighted Error
Quickest way to fix call-sites of changed functions
Why should you use it
Jumps to errors/warnings in the current document
Navigation
What it does
Main menu > Navigate > Next Change
Quick way to look through your changes in a document
(especially good in large files)
Why should you use it
Jumps to (VCS) changes in the current document
Navigation
What it does
Main menu > Edit > Find > Go to next highlighted element usage
Quick way to look at the usages of a variable/method
(especially good in large files)
Why should you use it
Jumps to next usage of the element at caret
Navigation
What it does
Main menu > Navigate > Declaration or Usages
Quick way to trace a call-graph or look into the implementation
(also works with indexed third-party libraries!)
Why should you use it
At call-site: Jumps to declaration
At declaration: Jumps to call-site
Navigation
What it does
Main menu > Navigate > Implementation(s)
Useful for jumping to the implementation from the interface method (trait)
Why should you use it
At call-site: Prompts for jump to declaration/implementations
At declaration: Jumps implementation
Navigation
What it does
Main menu > Edit > Find > Show Usages
Quick way to trace the call-path backwards or to estimate impact of changing a method
Why should you use it
Jumps to the usage of method/function at caret or prompts to jump if there are multiple usages
Navigation
What it does
Other > Bookmarks > Go to/Toggle bookmark <N>
Quick way to jump between functionality which is split between multiple documents or places within one large document
Why should you use it
Set and jump to bookmarked lines in documents
Code Insights
What it does
Main menu > View > Parameter Info
Calling a method is easier if you know what it expects
(see also: "Type Tetris", "Type Holes")
Why should you use it
Shows the expected parameters of the parameter list at caret
Code Insights
What it does
Main menu > View > Type Info
Helps if you're unsure whether the type of something you wrote is actually what you think it is
Why should you use it
Shows pop-up with type of selected expression
Code Insights
What it does
Plug-Ins > Scala > Show implicit arguments action
Very useful for finding/debugging implicit arguments or typeclasses
Why should you use it
Prompts for expressions at caret which use implicit arguments and lists those arguments (with jump to definition!)
Code Insights
What it does
Plug-Ins > Scala > Show implicit conversions
Helps to debug implicit conversion fuckery
Why should you use it
Prompts for expressions at caret and lists all implicit conversions in scope
Version Control
What it does
Main menu > VCS > Git > Fetch
Useful to update the version control tool window without pulling
Why should you use it
Fetches tracked remote branches
Version Control
What it does
Main menu > VCS > Git > Branches...
Quick way to do all sorts of git operations related to branching
Why should you use it
Prompts for git branches with most actions you can do with them
Version Control
What it does
Main menu > VCS > Git > Stash/UnStash changes...
If you need to quickly do something else while working on a larger task stashing is probably the best solution
Why should you use it
Opens dialog for git stash/unstash
Version Control
What it does
Main menu > VCS > Git > Show History for Selection
Incredibly useful for understanding why something was changed and who did it
Why should you use it
Shows all commits that touched the selected code
Version Control
What it does
Version Control Systems > Rollback Lines
Useful for reverting current changes in (parts of) a document without accidentally leaving remnants in the commit (e.g. whitespace changes)
Why should you use it
Reverts uncommited changes of selected lines
TODO:
Bookmarks
Move element right
Duplicate Line
Delete Line
Move Caret to Matching Brace
Multi-Cursor (Multi-Copy)
Implement/Override method
Show History for Selection
Open Recent
Extend/Shrink Selection
Move Caret to Next Word (Move Caret with Selection to Next Word)
Optimize Imports
Format Document
Add type annotation to value definition
Use named arguments for current and subsequent arguments
live templates
exhaustive match completion
Move Right
Move to opposite group
Goto next splitter
Close tabs without changes
Different CamelHumps modes
Productivity tips and tricks with IntelliJ (WIP)
By Felix Bruckmeier
Productivity tips and tricks with IntelliJ (WIP)
- 133