Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IDEA IDE - disable inspection for one file

Is there a way to disable inspection for one file opened in the editor? I occasionally open large library file in the editor to inspect its source code, and don't want IDEA to run inspections on this particular file.

like image 326
Max Koretskyi Avatar asked Apr 19 '16 13:04

Max Koretskyi


People also ask

How do I hide usage in IntelliJ?

If necessary, you can disable the automatic highlighting. Press Ctrl+Alt+S to open the IDE settings and select Editor | Code Editing. Clear the Usages of element at caret checkbox in the Highlight on Caret Movement section.

How do I ignore CheckStyle errors in IntelliJ?

Go to Settings|Editor|Code Style, choose a code style you want to import CheckStyle configuration to. Click on the gear, then 'import scheme', choose "CheckStyle Configuration" and select a corresponding CheckStyle configuration file. Click OK.

What is inspection in IntelliJ?

Code inspections In IntelliJ IDEA, there is a set of code inspections that detect and correct abnormal code in your project before you compile it. The IDE can find and highlight various problems, locate dead code, find probable bugs, spelling problems, and improve the overall code structure.


1 Answers

Use Hector the Inspector guy. You can access it by clicking on "guy in a hat" icon in Status Bar or via Code | Configure Current File Analysis... from the main menu.

Once there you can move the "Highlighting Level" slider from "Inspections" to "Syntax" .. or even "None" in case of a large or complex file.

enter image description here

Notes:

  1. Settings here affect current file only (excludes "Power Save Mode" option)

  2. Depending on a file, you may have multiple sliders (e.g. in .php file you will see separate sliders for HTML and PHP languages: this may change depending on some other settings):

    enter image description here

P.S. If your file is actually part of the library (PHP or JavaScript; "Library" in terms of IDE, of course) then they by default should not have inspections enabled in them:

enter image description here


UPDATE 2021-06-11:

Hector the Inspector has been removed from the status bar since 2020.2 version or so. You can get it back by installing Hector the Inspector plugin from Settings/Preferences | Plugins

like image 56
LazyOne Avatar answered Oct 14 '22 11:10

LazyOne