Make Jetbrains suck less

Rohan Büchner

Rohan Büchner / May 05, 2017

READING TIME––– views

Full disclosure, I'm a huge JetBrains fan, their tools are great...
but sometimes you need to customize your tools just a little to get the right amount of use out of them.

Originally this post was written for PHP specifically, but this applies to almost all JetBrains IDEs.

Make it fast:

Go to:
Help > Edit Custom VM Options

Then add or modify the following, as per your system's available resources.

bash
# custom PhpStorm VM options

-Xms512m
-Xmx2048m
-XX:MaxPermSize=350m
-XX:ReservedCodeCacheSize=225m
-XX:+UseCompressedOops
-XX:+UseCodeCacheFlushing

-Dawt.useSystemAAFontSettings=lcd
-Dawt.java2d.opengl=true

Go to:
Help > Edit Custom Properties

Then add:

# custom PhpStorm properties

editor.zero.latency.typing=true

Time to disable stuff. Rinse and repeat for all the following menu paths. Navigate to, then disable all the plugins/tooling/completions, etc. you **DON'T** need.

  • PHPStorm > Preferences > Inspections
  • PHPStorm > Plugins
  • PHPStorm > Editor > Language Injections

> Be warned, whatever you remove will effectively disable IDE assisting you with whatever features you've disabled.

Next is to exclude the project items you don't need. These will generally be folders that either have external dependencies you don't need to know the source of, such as node_modules, or output files and folders such as .bin / public that contain your compiled or minified code.

To do the above, in your project explorer, right-click on any folder, and then select:
Mark Directory as > Excluded

Give it context:

Make sure PHPStorm knows where your local tooling and frameworks are...
(because it might not)

Go to:
PHPStorm > Preferences > PHP

  • Choose your PHP version
  • Add CLI Interpreter
  • If none is present, add one.
  • If your PHP was added via brew, point to the location within Cellar to have access to the php.ini file (and not the sysmlink in /usr/local/bin)

Go to:
PHPStorm > Preferences > PHP > Composer

  • Setup interpreter to point to previously setup CLI interpreter
  • Point to your local composer (mine is symlinked to /usr/local/bin/composer)

Go to:
PHPStorm > Preferences > Tools > Terminal

  • Set your shell path to whatever shell you may or may not be using (ZSH, fish, or leave as default)
  • For some plugins or themes for ZSH / fish you need to disable shell integration. (Try both and see what works for you)

Make it smart:

  • Setup [PHP IDE Helper](https://github.com/barryvdh/laravel-ide-helper) if using Laravel
  • Install PHPMD, and CodeSniffer in the terminal (I hope you have [brew](https://brew.sh/) installed already)
  • brew install php-code-sniffer
  • brew install phpcs
  • brew install phpmd

Back to the IDE now, link up all the above utils via PHPStorm preferences:

Go to:
Languages & Prefrences > PHP

  • Code Sniffer
    • Update the path to point to your local phpcs path
      • (Get the path by running which phpcs in the terminal)
  • Mess Detector
    • Update the path to point to your local phpmd path
      • (Get the path by running which phpmd in the terminal)

> All that's left to do is, set up code sniffer and mess detector rules so that you don't code like a monkey, and if you try to, your computer overlord will shout at you.