Vitamin C

intellij-idea Little-known features

Language injection

If you want to write strings containing other languages (JSON, regexes), it's hard to keep up with escaping symbols, and it would be nice to get some code assist.

  1. Put your cursor inside an empty string
  2. ALT + ENTER
  3. Pick "Inect language or reference"

Pick "Inject language or reference"

  1. Pick the desirable language (RegExp in my case) from the pop-up

enter image description here

  1. Again use ALT + ENTER and pick Edit regex fragment

enter image description here

  1. In the new tool window enter the regex - note how it's automatically mapped to a properly escaped Java string. Similarly for JSON the indents will be placed properly.

Quick Preview

Check screencast video on YouTube about this feature

IntelliJ provides a quick-preview feature called Viewing Definition. Using this feature allows a user to quickly see the contents of a method/class without navigating into the class itself

  • OS X - (+Y) or (+Space)
  • Unix / Windows - Ctrl+Shift+I

Example: Looking into Arrays.copyOfRange(): enter image description here

Verifying if you've selected the right class in Search:

enter image description here

Or a quick look at some project files:

Got any intellij-idea Question?