Intellij Idea - Introduction

Intellij Idea - Introduction

Note for Mac users: Alt is same as Option

Note for Linux and Windows users: Cmd is same as Ctrl

General default behaviour

  1. CARET is the little blinking thing that you see when you type text.

  2. Learn default settings, try to avoid over customization.

  3. NoSQL has NoSupport.

  4. Do not version IDE specific files.

  5. In Idea placement of caret = context. And context will dictate what options will be available.

  6. Use SSD for fast intelli-sense.

  7. General caret moves work well: Cmd + Arrows, Shift + Cmd + Arrows, etc.

  8. The easiest way to learn Idea is by using : Tip of the day from Help menu

  9. Auto-curly braces in special blocks are added ad the end of the line or new line

  10. Code completion supports Quick Doc

  11. Sync settings and plugins : https://www.jetbrains.com/help/idea/sharing-your-ide-settings.html

    • Jetbrains account
    • Git
    • Export / Import

General features

  1. Facets

  2. Schema support

    • You can use a schema to validate and edit json and yml files
    • Schema support
  3. Diff

    • Files from modules
    • Dirs from modules
      • Select 2 and Cmd + D
    • Against external files
      • Select 1 and Cmd + D
    • Right click inside files : Compare with Clipboard
      • for selection
      • for entire file content
  4. Integrated History

    • Right click inside files : Local History
    • Right click on any file or directory : Local History
  5. Internal Terminal

    • Right click over any file and Open in terminal
  6. Right click over any file and Reveal in Finder

    • Helps to open the file manager where the file is located and select the file
  7. Bookmarks

    • F3 Toggle bookmarks
    • Cmd + F3 Open list of bookmarks
  8. Breakpoints

    • Toggle
      • Left click on the line
      • Cmd + F8
    • Edit or set condition and Open breakpoints window
      • Cmd + Shift + F8
    • When in debug, the panels have a Disable breakpoints button
  9. Hold cursor over a button, link, icon, etc. to get a tooltip with name of the feature

  10. Support for @Nullable, with default highlight level set to Warning

  11. Auto-contracts, deduced from method declaration: @Nullable vs @NotNull

    • An icon will appear at the line level to show the contract
  12. Auto-re-index

    • IDE updates
    • Plugin updates
    • Corrupt indexes
  13. File auto-save

    • Manual save still works, but useless
  14. Help and documentation

    • Open online documentation
    • F1 Button in general view
    • Help button in popups, contextual info
      • how info is organized
  15. Scroll from and scroll to features

Plugins

  1. Plugin: Presentation assistant

  2. Plugin: IntelliLang

Integration

  1. Plugin: Docker Integration

    • Advanced UI like Kitematic
    • Detection of dockerfiles with Run support
  2. Plugin: Git

    • Git log
    • Blame
    • Git-Undo per section of a file Cmd + Alt + Z
    • Compare with
  3. Plugin: Maven

    • Show basic phases only, and other settings
    • Run phases
    • Select multiple and run
    • Can be configured at project level and IDE level
    • By default has one integrated
    • If you change version of a plugin in pom.xml - Check the logs, IDEA could use the previous version of it
    • Preferences - Build, Execution, Deployment - Build Tools - Maven - Ignored Files - be aware of this list
  4. Plugin: .ignore

    • Help manage .ignore files
    • With highlight support
    • Can generate ignore files for various platforms
  5. Plugin: Database tools and SQL

    • Can CRUD database
    • Cannot change admin rights via UI
      • but can do it via SQL
    • Advanced table visualization features
    • For oracle Docker images you need to put in Username field: sys as sysdba
    • Tables are used for auto completion in SQL files from source code
    • Tx: setting should be considered
      • Important mention about Tx setting
  6. Plugin: Http client

Settings

We distinguish 2 categories

  1. IDE settings, applicable to all modules and IDE itself
  2. Module level settings

Most of the settings described here are available on both levels

  1. Setting: Editor / Inspections -> Java : Logging Placeholders

    • Set to warning, so that SLF4J shows if you have a missmatch between passed params and placeholders in the message.
  2. Setting: Editor / General -> Maximum number of contents to keep in clipboard

    • You can change content before selecting it for pasting
  3. Setting: Cmd + Shift + 8 Column mode on/off

  4. Setting: Editor / Code Style / Java -> Group Declarations : Align fields in columns

    • Group / align fields in one column and values after equals in other column
  5. Setting: Editor / General -> Highlight on Caret movement : Highlight current scope

    • Group / align fields in one column and values after equals in other column
  6. Setting: Editor / General Smart Keys -> Surround selection on typing quote or brace

    • The selected text get brackets or quotes instead of replacing
  7. Setting: Languages & Frameworks / SQL Resolution Scopes

  8. Setting: Editor / General / Appearance : Show inferred annotations inline

    • Show inferred annotations inline ###Within IDE
  9. Bottom right corner : 4 spaces change indentation

  10. Bottom right corner : Togle read only attribute file

Generation, completion and popup’ed information

  1. Alt + Enter The smart contextual aware thing

    • swiss army knife for various contexts
    • can generate code for a lot of situations
    • have different options
    • underlined words like errors - are focused and first option of Alt + Enter is available by default
      • when a class is used but not imported and Idea knows it
    • Alt + Enter, then Esc, then Alt + Enter
      • sometimes invoking Alt + Enter second time gives other options
    • Cmd + F1 Details on warning
      • when the caret is within an expression marked with warning background
      • pressing twice will expand to show details
      • Issue details for marked expressions
  2. Ctrl + Space Code completion

  3. Alt + Space Quick definition, shows the implementation of the symbol

  4. F1 Quick documentation

  5. Cmd + Alt + X then P evaluate XML tag

    • put caret on tag
    • click first combination - nothing will happen
    • then click P and small pop over will show up
    • Evaluate XML tag
  6. Cmd + N New File, Class, etc.

  7. Cmd + Shift + N New scratch file.

  8. Cmd + J Templates and Live templates support

    • you can have “shortcut words” (like keywords at IDE level) that’ll generate a code for you
    • they can work for selected text as well on their own
    • Schema support
  1. Navigation: Alt + F1 Select in…
    • Select the highlighted element in pretty much any context
  2. Navigation: F2 Goes to next issue
    • Next error, if there errors
    • Next warning, it there are no errors but are warnings
  3. Navigation: F4 Open module settings
    • Of the selected module
  4. Navigation: Shift + Shift Search everywhere
  5. Navigation: Ctrl + Tab Navigate in open tabs and panels
  6. Navigation: Cmd + E Navigate in recently closed files and panels
  7. Navigation: Esc to go to the main Editor
    • Not consistent when using Split tabs
  8. Navigation: Shift + Esc to go to the main Editor and close current panel
  9. Navigation: Cmd + Alt + ← (leftwards arrow) Go back to previous caret location
  10. Navigation: Cmd + Alt + → (rightwards arrow) Go forward to previous caret location
  11. Navigation: Cmd + O Open class
    • Press 2x to Include non project files - the ones from libraries
  12. Navigation: Cmd + Shift + O Open file
    • Press 2x to Include non project files - the ones from libraries

Selection

  1. Selection: Cmd + C : WHEN NO SELECTION - Copy line

  2. Selection: Cmd + X : WHEN NO SELECTION - Cut line

  3. Selection: Alt + ↑(upwards arrow) : multiple times

    • Select word
    • Select expression
    • Select whole line
    • special behaviour on code elements
  4. Selection: Alt + ↓(downwards arrow) : multiple times

    • De-Select word
    • De-Select Expression
    • De-Select Whole line
    • special behaviour on code elements

Edit

  1. Edit: Cmd + V Paste and has integrated column mode support
  2. Edit: Cmd + D Duplicate line or selection
  3. Edit: Cmd + Backspace Delete line
  4. Edit: Cmd + Ctrl + G Select all occurrences of a word inside a file
    • so that you can edit the selection
    • very close to what Shift + F6 does for symbols - limited to current file scope
  5. Edit: Cmd + Alt + M Extract method
    • Create a function from selection
  6. Edit: Cmd + Alt + C Extract constant
    • Create constant from selection
    • Move a hardcoded string or numeric value to a constant
  7. Edit: Cmd + Shift + U Change case
  8. Edit: Ctrl + Shift + V Paste from History
  9. Edit: Cmd + Shift + ↑(upwards arrow) : move statement up
  10. Edit: Cmd + Shift + ↓(downwards arrow) : move statement down
  11. Edit: Alt + Shift + ↑(upwards arrow) : move line up
  12. Edit: Alt + Shift + ↓(downwards arrow) : move line down
  13. Edit: Cmd + Alt + L Reformat
    • Can be applied only to selected portion
    • Can be applied to a folder
  14. Edit: Ctrl + Alt + O Optimize imports
    • Remove unused classes, ignore classes used in comments
    • Apply format rules for import statements
    • Can be applied to a folder
  15. Edit: Shift + Enter Start a new line under current one and move caret to it
  16. Edit: Cmd + Enter Split current line, move the content after the caret to a new line
  17. Edit: F5 Refactor - copy class
    • When file is selected in Project view or cursor is placed inside a name of a class (incl. inner classes)
  18. Edit: F6 Refactor - move class
    • When file is selected in Project view or cursor is placed inside a name of a class (incl. inner classes)
  19. Edit: Shift + F6 Refactor - rename class name
    • When a class is selected in Project view or cursor is placed inside a class name
  20. Edit: Shift + F6 Refactor - rename the folder or package name
    • When a folder or package is selected in Project view
    • Option Rename package: will consider all packages with same name in all modules
    • Option Rename folder: will rename only the current package and will update package and all imports for the current module

Next: Videos showing various features into Intellij Idea