Reputation: 129
WebStorm is not highlighting properly JS code whether its in HTML file or in JS file. It says unresolved variable or type document when I want to get ID of element using document.getElementByiD
.
I have also captured settings
Upvotes: 3
Views: 3819
Reputation: 2803
My problem was that I added an .eslintrc file but our project is using TS Lint. I just disabled eslint and things started working again.
Upvotes: 0
Reputation: 2271
I had the same or similar problem. Unresolved variables did not "highlight". But the problem occurred only on a single .mjs -file as far as I could tell. In others it did highlight those errors.
This was a big problem because I had a large set of JavaScript code which took much time to test-run to see how it worked, and having mistyped variable names caused it to fail but only after running it again and again after making any change.
I tried many things which did not help but finally this action got the unresolved variables error-highlighting to work again:
Open the file with missing error-highlights in WebStorm editor.
From the top menu-bar navigate Code -> Analyze Code -> Configure Current File Analysis
Choose "All Problems" (instead of "Syntax")
Upvotes: 0
Reputation: 5785
3 Things to try:
File | Invalidate Caches
and restart IDE. (credits @LazyOne)File -> Settings > Editor -> File Types
, select JavaScript
into list of file types and check if you have *.js
into list of extensions below. Alternatively try to create new draft (Shift+Ctrl+Alt+Ins) for JavaScript language and take a look if it get highlighted. (credits @Flying)File | Settings | Languages & Frameworks | JavaScript
and Choose ECMAScript 5.1
and press ok. Files shoud now be highlighted correctly. Then, open the menu again and re-select ECMAScript 6+
.Upvotes: 5