Search code examples
javascriptintellij-ideaintellij-14

How do I make IntelliJ ignore javascript syntax errors in one .js file?


In my IntelliJ project I have this file:

MyMvnModule\src\main\webapp\WEB-INF\Owasp.csrfguard.js

This file contains these placeholders that are filled in by a servlet at run time:

} else if(%DOMAIN_STRICT% == false) {
...
}

IntelliJ sees that %DOMAIN_STRICT% is a syntax error which causes it to angry red underline every folder in the path to that file. Is there a way to keep intelliJ from syntax checking this one file so that this doesn't happen?


Solution

  • To change the highlighting level for the current file:

    1. Open the Highlighting Level pop-up window by doing one of the following:
      • On the main menu, choose Analyze | Configure Current File Analysis.
      • Press Ctrl+Shift+Alt+H.
      • Click the Hector icon on the status bar (bottom right-hand corner).
      • Right-click the code inspection indicator at the top of the scroll bar. Choose Customize Highlighting Level.
    2. Move the slider to one of the three available positions that define the highlighting level:
      • None: turn highlighting off.
      • Syntax: highlight syntax problems only.
      • Inspections: (default) highlight syntax problems and problems found by inspections.