Wednesday, October 31, 2007

Configuring Eclipse

This describes how to configure Eclipse to play nicely with Drupal.

For PHPeclipse - PHP editing

We need to ensure that tab/indent inserts two spaces, and also that .inc, .module, .engine, .theme and .install files are recognised as PHP files.

Make the following changes under Window -> Preferences

  1. Expand the left-hand menu to General -> Content Types
    Under "Content types" on the right, click Text -> PHP Source File
    Add the *.engine, *.theme, *.install, *.inc, and *.module file types
  2. In the left-hand menu click on PHPeclipse Web Development -> PHP
    In the Typing tab, make sure the 'Insert Spaces for Tab' setting is checked
    In the Appearance tab, it is reccommended that you leave the 'Displayed tab width' at 4, so it is easier to spot if any (actual) tabs have snuck in
  3. In the left-hand menu click on PHPeclipse Web Development -> PHP -> Formatter
    In the Style tab, enter 2 for 'Number of spaces representing a tab'
    'Compact Assignment' and 'Indentation is represented by a tab' should both be unchecked

For Eclipse Web Tools - CSS, JS, XML and (X)HTML editing

Window -> Preferences -> Web and XML -> CSS Files -> CSS Source
Select 'Indent using spaces'
Set 'Intentation size' to 2

Window -> Preferences -> Web and XML -> Javascript Files -> Javascript Source
Select 'Indent using spaces'
Set 'Intentation size' to 2

Window -> Preferences -> Web and XML -> HTML Files -> HTML Source
Select 'Indent using spaces'
Set 'Intentation size' to 2

Window -> Preferences -> Web and XML -> XML Files -> XML Source
Select 'Indent using spaces'
Set 'Intentation size' to 2

If you use XTemplate:
Window -> Preferences -> General -> Content Types -> Text -> HTML
Add the *.xtmpl file type

Original Post: http://drupal.org/node/75242

No comments: