Html tags are highlighted inside php string expression. Is it right behavior?

Hello guys,

I've found some strange thing :)

HTML-tags inside of a php-string are highlighted like as HTML tags in HTML-context...and not looks like a part of string at all.

The real pain is:

I'm developing plugin for PhpStorm.
When I'm trying to find HTMLTag-psiElement in php file I get HTMLTag inside of StringLiteralExpression as a result. But it's wrong, html tag must be recognized as a part of string, but not as a part of xml tree. 

 

 

3 comments
Comment actions Permalink

Hi there,

So .. what is the question here? I assume it's the one from the title?

 

>Html tags are highlighted inside php string expression. Is it right behavior?

Yes -- it's expected/normal behaviour -- it's Language Injection in action.

If you do not like it -- please disable appropriate rule in "Settings/Preferences | Editor | Language Injections" to have such text to be treated as ordinary PHP string.

https://confluence.jetbrains.com/display/PhpStorm/Language+Injections+%28mix-ins%29+in+PhpStorm

 

>I'm developing plugin for PhpStorm.

Cannot help on this part, at all.

0
Comment actions Permalink

Hello,

You can also disable/change the highlighting at File | Settings | Editor | Colors & Fonts | General > Code > Injected language fragment.

For help on writing plugins, please ask your questions at https://intellij-support.jetbrains.com/hc/en-us/community/topics/200366979-IntelliJ-IDEA-Open-API-and-Plugin-Development .

0
Comment actions Permalink

I use a lot of SESSION values and so like to echo all my HTML - so having the syntax highlighting in echoed strings of HTML is a brilliant feature of phpStorm for me, really useful.

1

Please sign in to leave a comment.