Hiding "cannot resolve file" warning?

Right now lots of our source files have constructs like:

$link = ....blahblahblah....;

$text = "You may view the document at <a href='$link'>$link</a>";

In this case, I keep getting warnings that say "Cannot resolve file $link".  Is there any way to disable this warning? I've been digging through the settings looking for how I might disable this, but haven't found anything.



To permanently turn this particular Inspection OFF (for all files):
Menu -> File -> Settings -> HTML. Now untick 'Unknown href target'.

To temporarily turn this Inspection OFF (for whole file or for specific tag etc):
1) In editor navigate to the error place (in your particular case place cursor just before $link on line with <a href='$link'
2) Press Alt+Enter  or wait a bit until light bubble image appears and click on it
3) Select the very first option -- should be "Inspection 'Unknown href target' options", and select one of the desired "Suppress ..." options -- this will insert special comment into your code that will instruct PhpStorm to ignore this Inspection in specific place.


Thanks for the suggestion.

When I do Menu -> File -> Settings, the only HTML pages that are available are under Code Style, or Editor->Colors and Fonts.  (I'm using PhpStorm 1.0, if that makes a difference).

Similarly, the options that appear when I Alt-Enter on the warning are:
Edit Html Fragment
Language Injection Settings
Replace Quotes
Un-inject Language

If I select Un-inject Language, that ends up hiding the warnings (Although I guess that will suppress all sorts of html validation checking), but I guess that's good enough for now.



Sorry, my mistake: Correct path to the appropriate settings should be
Menu -> File -> Settings -> Inspections -> HTML

I'm currently using the latest EAP build, PS-98.91 (which you can refer to as v2 beta), so the light bubble and temporarily disabling specific inspection will indeed not work in v1.

Regarding "select Un-inject Language" -- that's quite tricky, since in my experience it is not that persistent and PhpStorm most likely will not remember this after restart.


Under Inpections->HTML, I have a number of inspections available, but not "Unknown href target".  I tried disabling every HTML inspection that is listed in the list, but none of them disabled the unknown href target.

The inspections in the list are:
Deprected HTML tag
Empty tag
Extra closing tag for empty elements
Form input without an associated label
Image size mismatch
Malformed content of <script> tag
Missing required attribute
Presentational HTML tag
Quirks Mode
Unknown HTML tag
Unknown HTML tag attribute.

Again, either way, thanks for the help and suggestions.


All inspections can be disabled right from the any produced warning: put cursor inside highlighted text. Press Alt+Enter, than Cursor Left. Select "Edit.."


I wish that were the case.  In the installation of PhpStorm that I am using (1.0.2, Build #PS-95.503) , other inspections can be disabled this way. (I've tried this and it works for other inspections)  This particular HTML warning cannot be, for some reason.  That menu item isn't there for this warning.

To contrast:
A normal PHP inspection, "unused local variable", when I press alt-enter, I see:
"Inspection 'unused local variable' options" with an arrow allowing me to go to a submenu where I can edit or disable the inspection.

For this HTML, I don't get a corresponding option.  The options I see are:
Edit Html Fragment
Language Injection Settings
Replace Quotes
Un-inject Language

A few more clues as to what may be going on:
When I play with the inspection profile sliders (By clicking the little inspections guy in the bottom toolbar), this particular warning still appears if HTML highlighting level is set to none, and PHP highlighting level is set to "Syntax" instead of "Inspections".  Does this imply that it's considered a PHP syntax issue and not an inspection? (are these separate things?)

Thanks for the suggestion, though.


Oh, this is injected code...
You can't remove this message now w/o disabling support for html inside of php literals.
The root case is that html annotator is not aware of $link meaning and there's currently no way to provide it with some insight.


Thanks Alexey.

Do you happen to know whether this is just the accepted way that it is (and will likely remain), or is this an known issue that Jetbrains plans to address?


Well, I can tell you exactly (pay attention to my "JetBrains team" badge) that this is known limitation of current implementation. We plan to address it eventually. Related request: http://youtrack.jetbrains.net/issue/WI-1828


Please sign in to leave a comment.