Open thernstig opened 2 months ago
@sean-mcmanus From what I can tell, these are coming from the C/C++ extension, can you confirm? And if so, I'll transfer the issue
@gcampbell-msft This was already reported for the C/C++ extension at https://github.com/microsoft/vscode-cpptools/issues/12716 . The errors labeled with C/C++ on the right are from our extension (so I think those are our issues), but the GCC ones are from another, maybe CMake Tools or from CMake -- the CMakeLists.txt might have some clang-tidy on build feature enabled.
I believe I see that we're populating this. @thernstig There are two things that I believe you could do:
1) Rebuild your project to get our extension to re-assess the diagnostics.
2) If you don't want our extension to provide these, you can disable the cmake.parseBuildDiagnostics
setting
@gcampbell-msft you are correct, the errors go away on rebuild. I understand the rationale behind this.
I have set set(CMAKE_C_CLANG_TIDY clang-tidy)
set in CMakeLists.txt
.
There are two things that makes this hard UX-wise for users when we see the error:
variable name 'a' is too short, expected at least 3 characters [readability-identifier-length] GCC
GCC
part to something like CMake Tools
or even better, if you can deduct this somehow from CMakeLists.txt
that it is clang-tidy that gives this error: CMake Tools - clang-tidy:
Are these feasible and make sense?
I think you should clear any build errors on file save or when starting to edit. At least the squigglies and maybe just keep them in the Problems pane. But with a clear indication it came from the CMake Build step (and preferably also clang tidy). The rationale behind this is what we see after we edit and save, the squigglies are not valid anymore and end up over code that it has no relation to.
I don't agree with this suggestion. Build errors should persist until the next build. Visual Studio behaves the same way. When I work through a list of build problems (e.g. when I'm refactoring code), I don't want the ones I haven't fixed yet to suddenly disappear because I fixed other ones in the file. That would require me to rebuild and that can take time. And I don't think CMake Tools should automatically rebuild the file on edit/save.
And I don't know of a way to make an error show in the Problems pane without also drawing a squiggle. In VS Code, extensions just report the Problems and VS Code handles the rest.
What CMake Tools could potentially do is add a code action for the build errors that allow you to dismiss them one by one.
@bobbrow I am not sure being able to dismiss them one-by-one is something I would personally use, maybe others would.
How would one solve the problem with that the yellow squigglies end up in the wrong place when doing any edits to the file? Are there any other ideas, or are we saying we have to live with this incorrect-placement-of-yellow-squigglies-on-further-edits?
I cannot come up with a good idea myself.
aside: Should I write a separate issue about the variable name 'a' is too short, expected at least 3 characters [readability-identifier-length] GCC
output not being clear maybe?
@gcampbell-msft Users want to know if we have a better solution to the problem of the yellow wavy line appearing in the wrong place, and if we need to create a new issue about unclear output.
Brief Issue Summary
This is a quite serious bug, as it completely hampers working with this tool when having errors and clearing them.
If you have common errors and then save a file, the errors do not get away on save. They stay. See here:
See also this capture. I am saving the file in between changes done in this video, before I hover the error:
https://github.com/user-attachments/assets/fe3c58ff-1bc0-4814-8ef3-90fb97f22f8d
I have no idea why this tool even shows errors like this, I initially wrote a bug report here https://github.com/microsoft/vscode-cpptools/issues/12716 thinking it was the C/C++ extension from Microsoft that had this problem, since it has built-in support for clang-tidy. But for some reason this CMake extension decides to also show errors. And those errors are not removed on save.
This issue is thus about that the errors are not cleared when you fix them and save the file.
Also, is there a way to completely disable them in settings? I already have the C/C++ to show these errors.
CMake Tools Diagnostics
Debug Log
Additional Information
No response