Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHPStorm 9 colors

Tags:

phpstorm

I noticed that if I'm editing a page with just HTML, but save the page as .php (there is no PHP in the page), there are no code hint colors. If I resave to .html, there are. Might there be a way to show the colors?

See below..

with PHP extension:

enter image description here

with HTML extension:

enter image description here

like image 215
user1040259 Avatar asked Sep 28 '22 00:09

user1040259


1 Answers

It's a bug introduced in recent 9.0.1 version.

The idea was to treat double extensions in file name and setup outer language automatically. What this means: in ordinary .php file all text outside PHP tags is treated as HTML/Plain Text .. but in files like file.js.php the outer language (text outside PHP tags) is most likely will be JavaScript instead of HTML. To have it as JavaScript (syntax highlighting and code completion/analysis) you would need to manually set it up to JavaScript on per file/directory basis.

So devs decided (after many votes in corresponding ticket) to automate this task. Unfortunately they did not checked well enough how it will work with other double extensions (.inc.php or .tpl.php in particular) hence the current behaviour/bug.

This behaviour is already fixed and 9.0.2 should arrive soon (few days). In meantime you can fix it manually in few different ways:

  1. You can just rename the file to get rid of such double extension, e.g. make it just header.php or inc.header.php.

  2. Or manually set outer language as HTML in Settings (Preferences on Mac) | Editor | Template Data Languages -- find your file there and set HTML in second column.


UPDATE: (18/08/2015)

PhpStorm v9.0.2 has now been released.

like image 109
LazyOne Avatar answered Oct 01 '22 02:10

LazyOne