Why I love PhpStorm: SQL GROUP BY handling

2 Replies

Here’s another post from my series why I love JetBrains PhpStorm. This is a SQL query, where I have I list of column names. The IDE not only marks the columns missing in the GROUP BY clause as errors, it also offers an option to fix it for you by adding them to the GROUP BY clause.

PhpStorm understands SQL mixed with PHP code.

More PhpStorm love:
SQL table aliases
JavaScript code completion with dojo

Use JSDoc 3 and PhpStorm to generate JavaScript documentation

1 Reply

This is an update to my former installation guide How to Generate JavaScript Documentation with JSDoc 3 and PhpStorm, which was written in 2013. Since then, JSDoc 3 moved from Mozilla’s Rhino to Node.js to generate the documentation, which is why that guide no longer works (unless you use an older version of JSDoc 3). This installation guide is written for Windows, but should also work on Linux and Mac.

Install and integrate Node.js

  1. Download and install Node.js.
  2. Integrate Node.js into PhpStorm:
    Open Settings (Ctrl+Alt+S) -> Plugins -> Install JetBrains Plugins -> Search for Node.js -> Install the Plugin
    Install NodeJS in PhpStormOpen Settings (Ctrl+Alt+S)  again and go to Languages & Frameworks -> Node.js and NPM. In the Node interpreter field, specify the local Node.js interpreter to use. Also press the Enable Node.js core button to enable code assist. For more details about Node.js in PhpStorm read IntelliJ IDEA 2016.1 Help | Node.js
  3. Install the node package manager npm from within PhpStorm:
    Install the npm package manager by clicking on the green add button icon add button. Beware to make the installation global by setting Options to -g, otherwise you end up with npm in your project folder. The -g option will install npm into your folder %AppData%/npm/step02For more details about using the package manager in PhpStorm read Installing and Removing External Software Using Node Package Manager.

Continue reading

PhpStorm: Complete code versus complete current statement

Reply

Here are two useful keyboard shortcuts for PhpStorm which sound similar, but are quite different:

complete code CTRL + SPACE
will either finish your code if what you typed so far is unambiguous or otherwise offer a list to choose from.

complete current statement CTRL + SHIFT + ENTER will add a semicolon at the end of your statement, no matter where the cursor is.

If you want to train your shortcut skills for PhpStorm or other software, the website shortcutFoo is really helpful and fun to use.

How to Generate JavaScript Documentation with JSDoc 3 and PhpStorm

6 Replies

This guide is outdated. I wrote the new tutorial Use JSDoc 3 and PhpStorm to generate JavaScript documentation

This is an update to my previous article How to create JavaScript documentation in PhpStorm, since the JsDoc Toolkit is no longer under active development. It got replaced by JSDoc 3, with better support for current coding practices, particularly the CommonJS Modules standard and also its improved format, Asynchronous Module Definition (AMD).

This guide should not only work for Jetbrains’ PhpStorm, but any IDE, such as Eclipse or Aptana, that lets you call an external tool with parameters. It is written for Windows 7, but should also work for Mac/Unix users with minor modifications. It assumes you have installed Java Runtime JRE 1.7 and added it to the Window system path.

Continue reading

Installing Xdebug on Windows and PhpStorm

Reply

There is a catch when installing Xdebug on windows: You need to set the full path of the extension directive in the php.ini, since the default directory is only used for non-zend extensions. Also don’t forget to use quotes.

;used only for 'normal' extensions
extension_dir = "C:Program Files (x86)PHPext"

;still necessary to use full path
zend_extension = "C:Program Files (x86)PHPextphp_xdebug.dll"

;won't work
;zend_extension = php_xdebug.dll

To make Xdebug work in PhpStorm you also need to enable remote debugging:

xdebug.remote_enable = 1

Why I love PhpStorm: SQL table aliases

2 Replies

Here’s another example for the reason why I like JetBrains PhpStorm so much: SQL code assist in the Database Console completes statements either in upper case or lower case depending on how you started typing, not to speak of understanding aliased tables when suggesting column names after typing a dot.

Screenshot: SQL code assist in PhpStorm understands aliased tables.

More PhpStorm love:
SQL GROUP BY handling
JavaScript code completion with dojo

phpStorm and documenting JavaScript

Reply

I’m awed again and again by phpStorm‘s features. I just came across this one: When I comment my JavaScript methods/functions with the @param, all IDEs I have tried out so far, let you only set a primitive type in curly braces, e.g.:

 /**
 * Some method description.
 * @param {Object} deferred dojo.Deferred
 **/
someMethod: function(deferrede) {
   // ...
}

Anything else would be marked as an error. But phpStorm is a lot, lot smarter.  When I’m using dojo it recognizes all classes and I can use them as a type, e.g.:

 /**
 * Some method description.
 * @param {dojo.Deferred} deferred
 **/
someMethod: function(deferred) {
  // ...
}

How to create JavaScript documentation in PhpStorm

1 Reply

Update 19.07.2013: How to Generate JavaScript Documentation with JSDoc 3 and PhpStorm

PhpStorm’s code assist feature nicely displays our own JavaScript code documentation. But what if you wanted to create a separate documentation you can hand out or integrate into your website? Then you should use jsdoc-toolkit. You can configure and run jsdoc-toolkit directly from PhpStorm. Here is what you have to do:

Continue reading

How to get code assist for dojo in PHPStorm

Reply

Update: Since Version 2.0 EAP 98.458 you get JavaScript library support, thus the following is obsolet.

In case you were wondering how you get dojo code support in PHPStorm even if dojo is not in your project folder, here’s the solution:

Install dojo in PHPStorm from external directory.

Make code assist for dojo work if it is in an external directory.

1. Open Project Settings

2. Select Directories

3. Add the path to your dojo folder as a new Content Root.

4. Mark the directories dijit, dojo, dojox as a Resource Root

That’s it.