Code Monkey home page Code Monkey logo

intellij-tips's Introduction

#IntelliJ Tricks by Victor Rentea, Software Crafter and Trainer

Me

Hi, DevTernity !

First day driving ...

Exploratory Refactoring

Typing

  • Autocompletion: person.firstName > person.fn > p.fn
  • Boilerplate: toString
  • Type-aware / snake-completion: MaritalStatus
  • Postfix Completion: .sout .log .assertThat
  • Live Templates: boot, logs
  • TAB completion
  • Statics (CTRL-SPACE x 2): ctm

Wrapping

  • Finish Statement (CTRL-SHIFT-ENTER :: ⇧⌘Enter)
    • if, method, class
    • method call: ofNullable(
    • Wrap generics: Optional<
  • Surround with (CTRL-ALT-T :: ⌥⌘T): if, try
  • Embrace Selection: while text is selected, press any of: {"'`<([

Smart Selecting

  • Multi-cursor
    • Token-based❤️ (ALT-J :: ^G) -- MovieType .html
    • ALT-drag -- .feature
    • ALT-SHIFT + click, click
  • Expand/Contract selection

👑 Quick Fix (aka Inspections)

(ALT-ENTER :: ⌥ ⏎):

  • Define Variable for expression
  • Define new type/method
  • Delete dead code
  • Syntax-Tree analysis: see Boolean Logic
  • Run inspection on entire project -- String.valueOf
  • and 500+ more 😊=> almost all are disabled by default

FP Support

  • ALT-Enter on .stream <-> for
  • Skip writing ".stream()"
  • Autocomplete after directly after ::
  • Collecting: ctl, cs, cj

Code inspection / Surviving Legacy

  • Quick Definition (Ctrl-Shift-I :: ⌥ Space)
  • Current Parameter (Ctrl-P)
  • Type of current expression (Ctrl-Shift-P)
  • Call hierarchy (CTRL-ALT-H :: ^⌥H)
  • Recent Files (CTRL-E :: ⌘E)
  • Recent Places/Changes (CTRL-SHIFT-E)
  • Bookmark (F11 :: F3)
  • Collapse / Fold (CTRL-. :: ⌘.)

Refactoring

  • Introduce Parameter, Functional Parameter, and Parameter Object -- Parameters.java

  • Add param from inside / from outside w/ ALT-ENTER

  • Extract Method (+ Auto-Parameterize) -- ExtractMethod.java

  • Combo: Extract over & Inline inner

  • Combo: Extract & Move/Convert to Instance

  • Extract / Inline / Encapsulate Field -- Fields.java

  • Extract explanatory variable (w or w/o preselecting)

  • Extract / Inline Interface

Next Steps

  • Become a Shortcuts Ninja 🥷: install "Key Promoter X" plugin

  • Practice all the moves yourself (pause-play this)

  • More Inspections: Download my (opinionated) inspections list (search Aggressive_Refactoring.xml on https://victorrentea.ro)

  • In-house workshop your company won't ever forget
    mailto:[email protected]

  • Join my Community of Software Crafters (>5000 members) for monthly live webinars and hot🔥 debates

intellij-tips's People

Contributors

victorrentea avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.