Webstorm: how to extend to handle PHP files or even just highlight code correctly?

十年热恋 提交于 2019-12-03 14:33:52

问题


I tried this IDE and I like it. Only problem is that if Im in a project that has some PHP in it, its confusing to see plain black text instead of correct PHP highlight.

I dont need brutal PHP autocomplete or so, but a syntax highlight. Is it possible to achieve in Webstorm?

Or the only option is to use PHPStorm?


回答1:


UPDATE: since TextMate bundles support was added to the IDE, you can add any language syntax highlighting to the IDE if there is TextMate bundle for it. See my reply about adding Ruby highlighting, it would be the same for PHP, just the different bundle.


Your best option is to use PhpStorm. Another option is to create your custom file type for basic syntax highlighting.




回答2:


Why not

File Menu > Settings > File Types > click 'PHP files' > click 'Add' in the bottom screen > enter '*.php'

(instead of html with .php)




回答3:


Associate the .php file extension to HTML file cause the IDE highlight at least HTML code correctly.

File Menu > Settings > File Types > click 'HTML files' > click 'Add' in the bottom screen > enter '*.php'.




回答4:


A late reply, but this worked for me:

use this textmate bundle: https://github.com/textmate/php.tmbundle

Then go to settings > File Types and associate *.php to PHP files.

Hope it helps.




回答5:


I tried the textmate bundle but it seems that there is an issue. I wasn't able to get highlighting. I think it is an unsolved bug, so I wonder if someone figured out how to use it.

http://youtrack.jetbrains.com/issue/WEB-11065

http://youtrack.jetbrains.com/issue/RUBY-14273

So I think I have to use PHPStorm to get basic syntax highlighting. Thats sad :/




回答6:


This questions describes how to install textmate plugin which gives you syntax highlighting:

Is it possible to get Ruby syntax highlighting in PHPStorm?

The only difference is that you want to use this bundle: https://github.com/textmate/php.tmbundle (but maybe there are better ones)



来源:https://stackoverflow.com/questions/11683978/webstorm-how-to-extend-to-handle-php-files-or-even-just-highlight-code-correctl

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