Syntax errors not going away after being corrected
Bug type: Language Service
Describe the bug
- OS and Version: macOS 12.3.1
- VS Code Version: 1.67.2
- C/C++ Extension Version: 1.9.8
- Other extensions you installed (and if the issue persists after disabling them): n/a
- If using SSH remote, specify OS of remote machine: n/a
- A clear and concise description of what the bug is, including information about the workspace (i.e. is the workspace a single project or multiple projects, size of the project, etc).
Syntax errors are correctly reported, but they do not go away after being corrected.
Extension has been uninstalled and reinstalled with no change in behavior.
Steps to reproduce
- Open any existing valid .c file
- Create syntax error by removing a matching paren (or any other syntax error - problem is not specific to matching braces)
- Syntax error correctly displays to the right of the incorrect line in red
- Correct the syntax error by undoing the previous change
- The syntax error display does not go away
- Close and re-open the same file and syntax error display persists
Expected behavior Displayed syntax errors should go away once corrected.
Code sample and logs
-
Code sample
-
Configurations in
c_cpp_properties.json{ "configurations": [ { "name": "Mac", "includePath": [ "${workspaceFolder}/**" ], "defines": [], "macFrameworkPath": [ "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks" ], "compilerPath": "/usr/bin/clang", "cStandard": "c17", "cppStandard": "c++98", "intelliSenseMode": "macos-clang-arm64", "configurationProvider": "ms-vscode.cpptools" } ], "version": 4 } -
Logs from running
C/C++: Log Diagnosticsfrom the VS Code command palette -------- Diagnostics - 5/19/2022, 10:09:58 AM Version: 1.9.8 Current Configuration: { "name": "Mac", "includePath": [ "${workspaceFolder}/" ], "defines": [], "macFrameworkPath": [ "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks" ], "compilerPath": "/usr/bin/clang", "cStandard": "c17", "cppStandard": "c++98", "intelliSenseMode": "macos-clang-arm64", "configurationProvider": "ms-vscode.cpptools", "compilerPathIsExplicit": true, "cStandardIsExplicit": true, "cppStandardIsExplicit": true, "intelliSenseModeIsExplicit": true, "compilerArgs": [], "mergeConfigurations": false, "browse": { "path": [ "${workspaceFolder}/" ], "limitSymbolsToIncludedHeaders": true } } Translation Unit Mappings: [ /Users/jburks/Projects/monetra-fdisoglobal/processors/firstdata/fdisoglobal/fdisoglobal_auth_detail.c ]: /Users/jburks/Projects/monetra-fdisoglobal/processors/firstdata/fdisoglobal/fdisoglobal_auth_detail.c [ /Users/jburks/Projects/monetra-fdisoglobal/processors/firstdata/fdisoglobal/fdisoglobal_auth.c ]: /Users/jburks/Projects/monetra-fdisoglobal/processors/firstdata/fdisoglobal/fdisoglobal_auth.c Translation Unit Configurations: [ /Users/jburks/Projects/monetra-fdisoglobal/processors/firstdata/fdisoglobal/fdisoglobal_auth_detail.c ]: Process ID: 32823 Memory Usage: 49 MB Compiler Path: /usr/bin/clang Includes: /Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include /Library/Developer/CommandLineTools/usr/include /Users/jburks/Projects/monetra-fdisoglobal/build/monetra /Users/jburks/Projects/monetra-fdisoglobal/processors/paytronix /Users/jburks/Projects/monetra-fdisoglobal/monetra/src /Users/jburks/Projects/monetra-fdisoglobal/mstdlib/include Frameworks: /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/System/Library/Frameworks Standard Version: c17 IntelliSense Mode: macos-clang-arm64 Other Flags: --clang --clang_version=110000 [ /Users/jburks/Projects/monetra-fdisoglobal/processors/firstdata/fdisoglobal/fdisoglobal_auth.c ]: Process ID: 32934 Memory Usage: 26 MB Compiler Path: /usr/bin/clang Includes: /Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include /Library/Developer/CommandLineTools/usr/include /Users/jburks/Projects/monetra-fdisoglobal/build/monetra /Users/jburks/Projects/monetra-fdisoglobal/processors/paytronix /Users/jburks/Projects/monetra-fdisoglobal/monetra/src /Users/jburks/Projects/monetra-fdisoglobal/mstdlib/include Frameworks: /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/System/Library/Frameworks Standard Version: c17 IntelliSense Mode: macos-clang-arm64 Other Flags: --clang --clang_version=110000 Total Memory Usage: 75 MB
------- Workspace parsing diagnostics ------- Number of files discovered (not excluded): 16340
------- Potential include path issues -------- Some headers exist in multiple locations. If IntelliSense is behaving incorrectly, try adding one of the alternate paths to the "includePath" in your configuration in c_cpp_properties.json to override the automatic path discovery for that header.
Using: /Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include/stdint.h Alternative: "/Users/jburks/Projects/monetra-fdisoglobal/3rdparty/jemalloc/include/msvc_compat/C99" Alternative: "/Users/jburks/Projects/monetra-fdisoglobal/build/3rdparty/jemalloc-prefix/src/jemalloc/include/msvc_compat/C99"
- Logs from the language server logging
Screenshots
Additional context
Hi @jamie-burks . If you wait for a while, do the error squiggles eventually disappear? Is the code involved particularly complex?
We are not currently tracking any general issues with squiggles failing to be refreshed, so would need more information about what you are seeing in order to investigate further. Specifically, Could you enable "C_Cpp.loggingLevel": "Debug" and provide the output of the C/C++ output channel leading up to the issue?
Is it possible that the errors are actually compile errors? When compilation fails, the gcc 'problem matcher' built into VS Code will display error squiggles for those compile errors, which will not be cleared until you compile again. Those error squiggles are not related to the C/C++ extension.
The red error with the text pops up in a second or two along with the red squiggle. After undoing the change, the red squiggle goes away in a second or two, but the red text never goes away even after sitting overnight. Even when I close and reopen the file, the text is still there without the squiggle. Shutting down and restarting VSCode is the only thing I've found to make the text go away.
As for compilation, I'm not configured to compile or build in VSCode, that's all handled in external scripts.
I can also add this only started within the last week or so. I believe there was a VSCode update that got installed at some point, but I can't say about the extension itself.
@jamie-burks , Could you clarify what you mean by "red text"? Do you mean the block that is displayed if you select "View Problem?

If so, I do see that lingers after the error has been addressed. That would appear to be a VS Code issue, and not specific to the C/C++ extensions.
No, the popup text to the right of the code. Here's an example:

And here's what it looks after the missing paren is added back with the error still displayed but the squiggle gone:

@jamie-burks Is that text coming from another extension, such as Error Lens? I don't believe that text is a feature of VS Code.
Yes, you are correct! Completely forgot I had that one installed. Will see what they have to say about it. Much appreciated.
Closing an external