Nick Heiner
Nick Heiner

Reputation: 122600

Making Eclipse view different file extensions as PHP

I have several file extensions, like .module, that I would like to be understood by Eclipse to be PHP - so I get the same syntax highlighting, code completion, etc features as I would if I were editing a .php file. How can I do this?

I went to Window >> Preferences >> General >> File Associations and added *.module to the file types list. When I click on *.module, it now says the associated editors are the PHP Editor and the Text editor.

However, when I open the *.module file to edit it, it gives me an error message:

Unsupported content type in editor. To associate a file extension with a supported content type, please see the Content Types Preferences Page.

What am I doing wrong?

fixed: restarted Eclipse, and now it works.

Upvotes: 28

Views: 15547

Answers (4)

Rajat Gusain
Rajat Gusain

Reputation: 1

Window > Prefrences > General > Content Types > Text > PHP Content Type add any type of file like *.module, *.install etc

Upvotes: 0

Shaun Montgomery
Shaun Montgomery

Reputation: 21

Something extra to be aware of.

I had the same problem, even after installing PDT. Turns out that there was an entry in General=>Content Types=>Text for *.php. Note that this not under General=>Content Types=>Text=>PHP Content Type, which is placed there by PDT. Removing the one under Text fixed the problem for me.

Upvotes: 1

cowgod
cowgod

Reputation: 8656

Head to Window -> Preferences. Drill down to General -> Editors -> File Associations. From here you can add your extensions (e.g., *.module) and associate them with your preferred PHP editor.

Then restart Eclipse for the change to take effect.

Upvotes: 43

plhn
plhn

Reputation: 5273

FYI.

window > preference > general > content types.
Expand '▷Text' and you will find 'PHP Content Type'. Select that.
Then click 'Add' and insert your own extension.

Upvotes: 16

Related Questions