14

New to WebStorm. Trying to determine why WebStorm does not always display highlights in source code, even though weak warnings are reported? As an example, there may be "2 weak warnings found", but only 1 line highlighted in the source editor window.

Is there another way to get a list of warnings, with warning explanations and links to the problem code? Or at the very least, with line number for reference?

Thanks.

LazyOne
  • 158,824
  • 45
  • 388
  • 391
K. Kwan
  • 143
  • 6
  • Having the same issue, 2 weak warnings also. I run code inspection and it says everything is fine though. Just the automatic inspection that doesn't give details says something is wrong. – Jegsar Oct 28 '15 at 12:59
  • Can you check my solution and let me know if it worked for you? If so, please remember to accept it as the answer! – elixenide May 01 '16 at 21:08
  • Just in case you simply didn't SEE the highlight: Pressing F2 navigates you to the next error in the file. If that tells you "no more errors", but inspector still reports one, you're good to go with the accepted answer. – D. E. May 12 '17 at 12:37

3 Answers3

14

I'm still not sure why this happens, but I have a fix. The short version is that you have to "kick" the IDE and get it to reset something internally. (I'm not sure what changes or where the IDE saves the change because I forgot to put the internal configuration under version control before playing with it, so I can't see what files it changed.)

This fix is tested in PHPStorm versions 10.0.1, 2016.1, and 2016.2 on OS X versions 10.10 (Yosemite), 10.11.2 (El Capitan), and 10.12 (Sierra).

Steps to Fix the Problem

Follow these steps:

1. Click on the inspector character in the lower right corner of the IDE:

enter image description here

2. Click on "Libraries in scope":

enter image description here

3. Check an option that is currently unchecked (I checked ECMAScript 6):

enter image description here

4. Click "OK" and return to the editor

5. Repeat steps 1-4, but uncheck whatever option you checked in step 3.

You should now get the magical green checkmark:

enter image description here

This glitch has driven me crazy for a while now, and it seems to have driven a few other people crazy, too, but the above steps seem to have fixed it for good.

Community
  • 1
  • 1
elixenide
  • 44,308
  • 16
  • 74
  • 100
  • 2
    This work on PhpStorm (version 2016.1.1) too. Was driving me nuts :D – Mārtiņš Briedis May 01 '16 at 21:04
  • Unfortunately, not working on PHPStorm 2016.2.2. One weak warning that won't go away. – LSerni Oct 30 '16 at 13:14
  • @lserni It's working on 2016.2.* for several people, including me. You might try going through the process again. Also, be sure to press `F2` or run Code Inspection to be sure you don't have any *real* weak warnings. – elixenide Oct 30 '16 at 13:42
  • Yes, that was my doubt too. You're spot on with your idea that PS needs a kick; as it happens I needed a stronger kick. Possibly, this is because I fiddled too much with the IDE while trying to get rid of the warning. But thanks, it was your answer that got me on the right path. – LSerni Oct 30 '16 at 13:47
0

Trying to determine why WebStorm does not always display highlights in source code, even though weak warnings are reported?

Usually such warnings have very "light" colors that are rather hardly visible. You may want to change them to better colors in your Settings | Preferences | Editor | Colors & Fonts | General

Is there another way to get a list of warnings, with warning explanations and links to the problem code? Or at the very least, with line number for reference?

Code | Inspect Code... where you can choose the scope (only current file; certain folder/scope etc).


If you need particular inspection only -- Code | Run Inspection by Name...

LazyOne
  • 158,824
  • 45
  • 388
  • 391
0

This was happening to me on a Javascript file app.js.

Ed Cottrell's answer seemed promising:

The short version is that you have to "kick" the IDE and get it to reset something internally.

But his workaround did not work for me (2016.2.2), nor did the following:

  • copy all contents, cut it away, save the file, paste it back.
  • hit F2 to trigger inspector
  • run inspector manually (Code > Inspect Code)
  • invalidate all caches and restart

So I thought I would carve down what piece of Javascript was triggering the fake error. To begin with I made an identical copy of app.js (Ctrl-C + Ctrl-V in the Files tree). I planned on removing code until I got rid of that pesky weak warning.

The new file (identical - same MD5 even) had no warnings and the green checkmark.

Okay, so I thought "I'll just delete app.js and rename appcopy.js. This will not go well with SVN but what the heck".

Then I thought I was first going to rename app.js, and I did. That triggered the refactor dialog. Silly me, I don't want to do that, and I hit Cancel. Then hit Refactor->Rename again but unchecked all refactorings.

And it was at that point that I noticed the green checkmark had appeared in app.js too.

So I hit Cancel again, and deleted the appcopy.js file.

The weak warning returned on the surviving app.js file!

Okay. Let's start again...

Final procedure

  • Ctrl-C + Ctrl-V and I have a new appunisci.js file identical to my app.js. Green checkmark on both. If only it were that easy...
  • Rename app.js without refactoring and app.js becomes spunisci.js . My app is now broken but no changes to the code are performed.
  • Rename appunisci.js without refactoring into app.js . My app now works again, I have an extra file and a SVN mess.
  • I now have an app.js with the green check mark
  • Finally delete spunisci.js to get rid of the extra file.
  • app.js is still OK!
  • from the command line, since I had also modified app.js (otherwise a simple revert would have fixed SVN)
    • copy app.js to app.bak
    • run svn revert app.js to reset Subversion history
    • copy app.bak to app.js to recover my changes
    • run svn status and confirm that app.js is "M" and not "R +"
  • courting disaster, I hit F2 in PHPStorm and also tried Code > Inspect Code...
    • "No suspicious code found" (as before), green checkmark.
LSerni
  • 55,617
  • 10
  • 65
  • 107