HTML script tag : bogus errors displayed for valid references

Answered

Hello, new to html (Using PhpStorm 2016.2), i see this while editing top level index.html 

Although PhpStorm cant seem to figure out that this is a reference to a file in the project, i get no assistance whatsoever when entering the file path/name, and i get the dreaded errors indicators. What gives ? syntax is ok, this runs. Am I missing some setting somewhere ?

Per request : image of settings->editor->language injections

 

thanks 

0
8 comments

Hi there,

What errors exactly?

In any case: please share a screenshot of "Settings/Preferences | Editor | Language Injections"

You may also place caret there (inside problematic space) and invoke Alt+Enter (Windows/Linux) and attach the screenshot of the appeared menu.

0

Andriy

 

statement is 

    <script src="resources/js/vendor/jquery.mobile-1.4.5.js"></script>

if i place the carret on the 'resources' token (which is part of a path) i get this when doing alt-enter

IDE seems to interpret the token "resource/js/vendor/jquery.mobile-1.4.5.js" as actual code, while it is a path (in a `src` attribute). 

0

"Settings/Preferences | Editor | Language Injections"

Please delete 2nd rule from the bottom (the one with "IDE" in last column). Alternatively just choose "Un-inject Language/Reference" from Alt+Enter's menu (but it should just disable the rule and not delete it)

You have somehow injected AngularJS into script's src attribute, hence the errors

0

errr ... no idea how that got there , i should have picked it up when creating the screen shot. This started its life as a Webstorm new HTML5 boilerplate project ( I checked, WS does not do this). I then opened in PhpStorm because i dont know how to get the "Database" left-hand-side tool in WebStorm, and voila ! mess and misery.

Thanks a log Andriy, if you can mark this as answered i would appreciate.

0

Accidentally created by the user (typing too fast without looking at what is happening on a screen).

Happens from time to time -- but usually I see some stuff injected into <div> tags; attributes -- rarely.

 

Alt+Enter, Choose "Inject Language or Reference" and choose desired one -- that's the way if you need to create such injection rule on purpose.

0

while i have your attention. When i use WebStorm (latest), i cant seem to get the database tool as per included screen shot (from my PhpStorm).  I am doing this project in PhpStorm because of that.  Do you know if this is part of WS and if yes how i can activate it ?  thank you again for all the help.

 

0

PhpStorm = WebStorm + PHP + DB/SQL support

There is no Database support in WebStorm. Only 3rd party plugins (e.g DB Navigator)

https://youtrack.jetbrains.com/issue/WEB-13293

https://youtrack.jetbrains.com/issue/WEB-6171

0

oh ... Did the upvote thing ... third party plugins are extremely shy of the excellent tool provided by IntelliJ in its other products. Shame it is not bundled in WS.  thank you again.

0

Please sign in to leave a comment.