Sangoku
Sangoku

Reputation: 1606

How to open a PHP file with a JS or HTML Editor in Eclipse

I normally open a file with it's default editor. Thus a .php file is opened in the default PHP editor and treated like a PHP file.

However, often the code in my PHP files contains a lot of JS or HTML. In these cases it would be nice to open such PHP files using a JS or HTML Editor. Right now, this is a pain since I have to click on Open With -> Other and then choose the JS or HTML Editor.

Is there a way to add the JS or HTML editor as an option to the Open With menu ?

Upvotes: 1

Views: 2722

Answers (1)

Ashutosh Jindal
Ashutosh Jindal

Reputation: 18869

Try adding the PHP file type to Content types. Go into Eclipse Preferences General > Content Types

enter image description here

  1. Choose JavaScript Source File in Content Types and,

  2. In the File associations click Add and add *.php like so :

enter image description here

Then in the Open With menu for php files, the JS Editor should start appearing like so :

enter image description here

Upvotes: 3

Related Questions