问题
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 ?
回答1:
Try adding the PHP file type to Content types. Go into Eclipse Preferences General > Content Types

Choose
JavaScript Source File
in Content Types and,In the
File associations
clickAdd
and add*.php
like so :

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

来源:https://stackoverflow.com/questions/11983973/how-to-open-a-php-file-with-a-js-or-html-editor-in-eclipse