Injection Language - lost Language
Hi,
I have this:
$css = '
.CuContactErrorField {
border-color: #AA0000;
}
#CuContact_errormsg {
display: none;
border: 1px solid #BB0000;
padding: 7px;
margin: 25px 0 30px 0;
width: 396px;
}
';
You see, it is CSS-Script in an php-variable. But when I tell phpStorm, that it is CSS it works for a litle time. But when I go to an other part of the code, an then back to this variable, phpStorm did forget, that it was CSS-Code.
Is it possible that I need to tell phpStorm that one only time?
With JavaScript i have the same Problem.
Thank you,
cu
请先登录再写评论。
Hi Jorg,
I've no idea why language injection is dropped (if you were not closing the file/restarting PhpStorm then maybe it worth reporting to the Issue Tracker for further investigation). But you can use this approach for a permanent injection:
Manual injections are by definition temporary.
The only way to have a persistent injection for a PHP string literal now is to use one of predefined "trigger patterns" - see Settings|Langiage Injection.
For css corresponding pattern is to use heredoc named CSS.
We have plans to inroduce other ways for more complex cases, but <<<CSS remain most non-intrusuve, self-documenting and does not require any storm-specific code annotations.
Hi thank you very much (Both).
That was what I'm looking for.
I needed a litle time to understand that the end oft such part (the pattern, that shows phpStorm to stop) has to be the first sign in the line.
Thank you
Well this is normal PHP HEREDOC literal requirement http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
Thank you!
Thats nice
Hi,

![]()

Now if worked a litle bit with thes heredoc...
But know if have a nother (litle) problem with code-completition.
I have this:(press STR+SPACE on Courserposition)
I want this:
Is it a BUG? - or is it implementet? Or is it switchted off in my Settings?
###
I have just seen, the same Problem is, when I have code in normal " (not heredoc).
cu
Hi Jorg,
Did you attached images or something? Because I see nothing - current text (what I see) does not make much sense to me.
Hi,
did you see my update (i think, now the pictures must be shown)
Thank you
cu
Hi,

Works for me:
Maybe you have injected the wrong language? Use Alt+Enter and see what language is injected.
Hi,

Language Injection is HTML
You can see my Settings here:
But it doesn't work for me.
?
cu
No idea, sorry.
Hi, Jörg! Could you please report this problem to YouTrack: http://youtrack.jetbrains.com/dashboard#newissue=yes
It would be very helpful if you attach your file in which HTML injections don't work.