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

孤街浪徒 提交于 2019-12-11 13:40:08

问题


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

  1. Choose JavaScript Source File in Content Types and,

  2. In the File associations click Add 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!