Any way to disable or change syntax error highlighting for the current line?

Answered

I love that IntelliJ has some great syntax checking, but I hate that it is constantly flagging the line I'm currently editing for various errors. The most common is a missing semi-colon. I know that I need one, and I know that I will be placing one once I finish the statement. I want IDEA to give me that chance before telling me I'm making a mistake.

In other IDEs, syntax checking is usually performed after the current line has lost focus (usually by pressing return or an arrow key). This makes sense. If I forgot a semi-colon, used the wrong type, etc, I want to know about it right away, but I need to be given the chance first.

Take a simple for loop as an example. While typing the line, IntelliJ flags 8 different errors as I write, with each new one shifting the error highlighting (red squiggles) which is distracting.

for                                                          error: expected (
for ()                                                    error: statement expected
for (int )                                             error: unexpected token, statement expected
for (int i = )                                    error: ; expected, expression expected
for (int i = 1;)                                 error: ; expected, ; expected
for (int 1 = 1; i <)                         error: expression expected
for (int 1 = 1; i < 10)                   error: ; expected
for (int 1 = 1; i < 10; i++)         error: statement expected
for (int 1 = 1; i < 10; i++) {     finally error free


The best solution would be for the error evaluation to recognize that a statement is in the process of being edited and not flag any syntax errors, but this seems unlikely. An easier solution would be an option to suppress syntax errors on any new lines until the text carrot has moved to a different line.

Also, I can't seem to find ANY options specific to syntax highlighting, i.e. a way to suppress squiggly lines for all "missing semicolon" errors. Considering the breadth of code analysis options, it seems strange that there is no control over syntax errors.

1 comment
Comment actions Permalink

Currently you can't turn off syntax errors. However, you could set "autoreparse delay" to something large, e.g. 10000 milliseconds (See Settings|Editor|General - Error Highlighting - Autoreparse delay). That way the red squiggles won't appear until you stop editing for 10 seconds.

0

Please sign in to leave a comment.