This post started out about code formatting, but it's grown to include all my Eclipse setup.

History
Originally I built a PHP formatter in Zend Studio, but I had difficulties setting up the free Eclipse PDT with this config. I followed instructions at: http://drupal.org/node/75242, then tweaked some of the configuration. I pulled it into Eclipse (Juno), changed the XML paths and ignored the warnings, then resaved it out again from the wizard to get it in the right format.

Eclipse setup

  • Install Eclipse
  • Install Eclipse PDT (as a plugin)
  • Install PDT Formatter
  • Install PyDev
    Configure a Python interpretter
  • Javascript->Code style->Formatter
    Import file below
  • PHP->Code style->Formatter
    Import file below
  • General -> Content types
    Add *.module
    Add *.install

Changelog

0.1: Drupal.xml
0.2: Drupal-withArrays.xml
0.3: Lightenna-PHP-JS-v0p3.xml
Split JS and PHP apart because the file syntax is incompatible
0.4: Lightenna-PHP-v0p4.xml

I modified David Kent Norman's Drupal.xml code formatter for Zend Studio/Eclipse PDT so make arrays look nice. It's minor stuff, but such a relief to give up inserting spaces and indenting. I think Turing said that computer programming should always be an interesting task, because any trivial activity could be automated.

AttachmentSize
Drupal-withArrays.xml18.44 KB
Lightenna-PHP-v0p4.xml25.93 KB
Lightenna-JS-v0p4.xml29.43 KB