Search code examples
phpstorm

How can I "uninspect" a file in PhpStorm?


By "uninspect" I mean this: I was browsing my source code, and opened up a library JS file. This file contained a number of things that PhpStorm's Inspections found, including some errors. These errors are now highlighted in my Project window, with red underlines right up to the root of the repo. But they're out of my control, I don't want to change library files, and I don't want to be constantly reminded of the errors. How do I prevent this highlighting and just ignore that file?

One option I've discovered is defining of a custom Scope that contains JS code I do care about, and doesn't contain these library files, and I could then apply the relevant inspections only to that scope. But that's a bit of work, adds complexity, and would need maintaining - really I just want to go back to how things were before I opened the file! Can I reset it, or delete a cache, or just easily mark a folder as "ignored"?

I'm using the latest stable version of PhpStorm, 2016.3.


Solution

  • Multiple options:

    1. File | Invalidate Caches... and restart IDE

      NOTE: this affects all projects and will also delete your Local History (if you are using it).

    2. Click on "inspector guy" icon in Status bar (access the same via Code | Configure Current File Analysis...) and make any adjustments needed there.

      For example: disable any inspections for this file.

    3. You may add such file as a JavaScript library (Settings/Preferences | Languages & Frameworks | JavaScript | Libraries).. so IDE will ignore errors here.

    4. You can mark this file as Plain Text (via context menu in Project View panel) -- such file will be treated as Plain Text (as if it would be ordinary .txt file) which means it will not be indexed as JavaScript / content will be ignored.

    5. "...or just easily mark a folder as "ignored"?" -- since you have mentioned it yourself .. and if you really wish to do it this way -- right click on parent folder and choose Mark Directory As | Excluded.