jack_snipe
jack_snipe

Reputation: 129

WebStorm is not highlighting JS code

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.

enter image description here

I have also captured settings

enter image description here

enter image description here

Upvotes: 3

Views: 3819

Answers (4)

user28520416
user28520416

Reputation: 1

Mine had power save mode on, I turned it off in notifications

Upvotes: 0

Josh Woodcock
Josh Woodcock

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

Panu Logic
Panu Logic

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:

  1. Open the file with missing error-highlights in WebStorm editor.

  2. From the top menu-bar navigate Code -> Analyze Code -> Configure Current File Analysis

  3. Choose "All Problems" (instead of "Syntax")

Upvotes: 0

Hannes Schneidermayer
Hannes Schneidermayer

Reputation: 5785

3 Things to try:

  1. Try File | Invalidate Caches and restart IDE. (credits @LazyOne)
  2. 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)
  3. Go to 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

Related Questions