-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clang-tidy and "editor.formatOnSave": true,
not updating properly on save
#12716
Comments
Your screenshot says the clang-tidy warning is from a "GCC" source, which is not our extension. Are you able to repro the bug using the clang-tidy integration from our extension? |
@sean-mcmanus I do not have any other C/C++ extensions in my repo. The problems look like this in the problems pane: These are the enabled extensions: It is from your extensions. See here: |
@sean-mcmanus I accidantelly closed this, can you please re-open? I did some more extensive testing. You can see in this image that the only extensions enabled are the Remote Development (locally) and the 4 extensions you see in the remote in the picture below. For reference, It seems it is your sister extension CMake Tools that does add the extra warnings seen. But neither your, nor the CMake Tools extension is clearing the issues properly on save. It is very easy to reproduce. Just introduce a variable with a short name of one character, save, change it to a longer one, save again etc. |
@thernstig I think the C/C++ issues may be our bugs. |
My recollection is that the CMake Tools extension only adds and removes problems after a build. If the GCC problems are coming from CMake Tools, the way to clear them is to rebuild. If you don't want CMake Tools to report build errors in the Problems, I believe there is a setting for that. |
@bobbrow @sean-mcmanus you are entirely correct! I am tracking it with the CMake Tools extension here instead However, there is still a bug with also the C/C++ extension. See this video: sample.mp4Notice how the error from this extension is visible. I then just plainly save the file. And then this extensions' error is gone even though I did not fix the problem. So the error seen here is not exactly as described in the original post, but related. Should I create a new issue or reopen this one? |
Environment
OS and Version: Windows 11 23H2
VS Code Version: 1.92.2
C/C++ Extension Version: v1.21.6
If using SSH remote, specify OS of remote machine: wsl (Ubuntu 20.04)
Bug Summary and Steps to Reproduce
Bug Summary:
clang-tidy and
"editor.formatOnSave": true,
not updating properly on save. The integration works when opening a file or reloading VS Code. But often when working and save all the time, the clang-tidy output does not get updated. It works fine via the CLIclang-tidy
so this is a VS Code extension/integration fault towards clang-tidy.Another example without the ErrorLens extension enabled:
Running it in the shell shows:
> clang-tidy -quiet -p build/Debug/ src/helloworld.c 1387 warnings generated.
Steps to reproduce:
.clang-tidy
and.clang-format
:Expected behavior:
For it to work. This is a rather crucial bug I would say, as this not working will be a large time sink for teams as we cannot see faults properly directly when we code, but have to run the linting separately in one way or another.
Configuration and Logs
-------- Diagnostics - 9/14/2024, 3:21:07 PM
Version: 1.21.6
Current Configuration:
{
"name": "CMake as IntelliSense provider",
"includePath": [
"/home/tobias/code/c-test/"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c99",
"intelliSenseMode": "linux-gcc-x64",
"compileCommands": "/home/tobias/code/c-test/build/compile_commands.json",
"configurationProvider": "ms-vscode.cmake-tools",
"compilerPathIsExplicit": true,
"cStandardIsExplicit": true,
"cppStandardIsExplicit": false,
"intelliSenseModeIsExplicit": true,
"compilerPathInCppPropertiesJson": "/usr/bin/gcc",
"compileCommandsInCppPropertiesJson": "${config:cmake.buildDirectory}/compile_commands.json",
"configurationProviderInCppPropertiesJson": "ms-vscode.cmake-tools",
"mergeConfigurations": false,
"browse": {
"path": [
"/home/tobias/code/c-test/",
"${workspaceFolder}"
],
"limitSymbolsToIncludedHeaders": true
}
}
Custom browse configuration:
{
"browsePath": [
"/home/tobias/code/c-test/src"
],
"compilerPath": "/usr/bin/gcc",
"compilerArgs": [],
"compilerFragments": [
"-g -std=gnu90"
]
}
cpptools version (native): 1.21.6.0
Translation Unit Mappings:
[ /home/tobias/code/c-test/src/helloworld.c - source TU]:
/usr/include/stdio.h
[ /home/tobias/code/c-test/src/main.c - source TU]:
Translation Unit Configurations:
[ /home/tobias/code/c-test/src/helloworld.c ]:
Process ID: 23834
Memory Usage: 20 MB
Compiler Path: /usr/bin/gcc
Includes:
System Includes:
/usr/lib/gcc/x86_64-linux-gnu/9/include
/usr/local/include
/usr/include/x86_64-linux-gnu
/usr/include
Standard Version: c23
IntelliSense Mode: linux-gcc-x64
Other Flags:
--gcc
--gnu_version=90400
[ /home/tobias/code/c-test/src/main.c ]:
Process ID: 23756
Memory Usage: 15 MB
Compiler Path: /usr/bin/gcc
Includes:
System Includes:
/usr/lib/gcc/x86_64-linux-gnu/9/include
/usr/local/include
/usr/include/x86_64-linux-gnu
/usr/include
Standard Version: c23
IntelliSense Mode: linux-gcc-x64
Other Flags:
--gcc
--gnu_version=90400
Total Memory Usage: 35 MB
Browse Paths from compile_commands.json, from workspace folder: /home/tobias/code/c-test
/home/tobias/code/c-test/src
------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 4909
The text was updated successfully, but these errors were encountered: