Turn off the Spelling inspection, unless you really enjoy your IDE telling you that function names are not valid English words! Alternatively you can open it up, choose the Typo inspection, and configure it to only spell check in comments, but I prefer to just disable it and spell things properly myself. First, choose Default in the drop-down at the top left (not Project default) and click Share profile. For me, it's best to set up the global inspections and use them for all projects, so that's what we'll cover here, although it's also possible to have different inspections for different projects. You absolutely don't want inspections to be showing you any false positives if possible, since this will create a 'boy who cried wolf' effect where you won't notice things that are genuinely wrong because you're so accustomed to looking at 'wrong' inspections. Inspections are a really powerful way of letting you know you're writing crap code, and will often catch things that most humans will miss. Head to File Types, click PHP files in the upper pane, and add *.install, *.module, *.profile, *.test, and *.theme. File typesĭrupal has some unusual file extensions and you will need to configure these under PhpStorm to be able to edit them.
Head into each section of Code Style, such as CSS, HTML, etc and make sure all indents are set to 2 on everything. You will also want to make sure that under Code Style > General you have set Line separator (for new files) to Unix (this is especially important if you're using Windows) and set Right margin (columns) to 80.Īgain, under Code Style > General, set Tab size, Indent, and Continuation indent to 2. Next, check that under File encodings, the IDE encoding is on UTF-8. The rest of the settings in Code style > PHP are actually very sensible, and the only other thing you might want to consider is in the Other tab, turning on Indent code in PHP tags which is not a Drupal standards issue, but I do prefer code that way. Change Tab size to 2 (usually it defaults to 4) and also change Indent and Continuation indent to 2 too. Head to Code Style > PHP and make sure Global settings is in use at the top, otherwise you'll have to set these options for each project you work on. Turn on Show line numbers unless you love not knowing what line you're on. Now, expand Editor and head to Editor > Apperance. Also, turn on Ensure blank line before end of file on Save. Head into the settings from File > Settings.įirst, go to Editor and in the Other section, set Strip trailing spaces on Save to All. You are using the Sun version, right?! Basic settings I'm going to assume you've set it up, you're using Ubuntu (mostly it won't matter what OS you're on for this blog post) and you're using the Sun version of Java. This is not a post to discuss IDEs or the merits of one platform above another, but suffice is to say that PhpStorm, against all odds, is now my preferred IDE on Linux.
Second of all, I lost so many hours of my life to frustrations with Eclipse that I was quite happy to fork out the relatively low cost once I'd given it a trial. We took some time to go through all the various custom settings and get things set up to obey Drupal's coding standards, so we thought we'd share.įirst of all, JetBrains's PhpStorm IDE is payware. JetBrains PhpStorm, is, surprisingly, an incredible IDE, and works extremely well for Drupal development.