I observed a similar behavior on a big project, while editing really long lines with the _ char.
i think it’s due to the syntax checking running.
sometimes while typing a quick correction to an existing line and pressing F5 to compile the project, the modified line remains underlined in red, as it has a syntax error, while being perfectly fine, because the syntax checking is not yet completed.