You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Implement enhanced integration with clang-tidy #2908
Reacted by KaiN, Maxime GRAC, Aarash Yaadegarnia, Jacob Stearns, Shelper, Didier Capozzi, David Brown, Joel Spadin, Hennadii Chernyshchyk, Ophelia and 56 more
Reacted by Jacob Stearns, Shelper, Didier Capozzi, Hennadii Chernyshchyk, David Brown, Timothy, Rahat Dhande, evanpham, alexFickle, Thor Jonsson and 44 more
I believe it makes sense for Microsoft to start looking at this. The only real alternative will no longer be maintained. notskm/vscode-clang-tidy#45
Is there anywhere else where we can vote for this feature that would have more visibility?
Reacted by Ben Vanik, mumin guler and Cornel Izbașa
It's great that it's happening. But what about CMake support? Even about VS I could only find how to enable it via CMakeSettings.json and nothing about configuration via presets.
Hristo Hristov (@Zingam) It works with CMake Tools as the configuration provider, i.e. it just hooks into whatever configuration is being used for IntelliSense. We won't have "run on build" for V1, but "Run Code Analysis on All Files" should be exactly the same if you have the configuration provider or compile commands set. Was there additional CMake support you wanted?
Sean McManus (@sean-mcmanus) I was thinking in the context of CMakePresets something like the settings in CMakeSettings.json https://docs.microsoft.com/en-us/cpp/code-quality/clang-tidy?view=msvc-170 It maybe more of a case for the CMake extension.
Let me see how the integration will work when you release it. It got merged right on time. I hope it won't be too long before release so I have the time to gain experience first hand myself. I plan to start integrating clang-tidy and the other tools in our project and I want to "enforce" them on the other developers by some global setting, so I don't have to explain myself over and over to each one of them how to setup and use these tools.
Hristo Hristov (@Zingam) You should be able to enforce the clang-tidy rules with a checked in .clang-tidy file. But if you want to exclude certain folders from being processed (i.e. due to the code not yet conforming to the .clang-tidy rules or owned by other teams), then you'll also need to check in a .vscode/settings.json with C_Cpp.codeAnalysis.exclude set as well.
Sean McManus (@sean-mcmanus) I tested the feature in the insider version, and it works seamlessly. Thanks a lot to you and the team for implementing this!
There are some known bugs we're working on fixing still for 1.8.0 (e.g. saving of headers may fail if clang-tidy is processing the header as part of a TU that is different from the "default" TU chosen by IntelliSense). And the clang-tidy quick fixes are postponed till the next release.
Reacted by Hristo Hristov, Rick Staa, Robin Seitz, Ben Spoor, Mikkel Aunsbjerg Jakobsen and stonegray
Activity
sean-mcmanus commentedon Dec 10, 2018
We support clang-format already. Other VS Code extensions might exist that use the other clang tools.
ci70 commentedon Dec 10, 2018
Ugh. They don't.
lawsonfulton commentedon Jun 21, 2019
Here's another vote for clang-tidy
skomik commentedon Jul 25, 2019
And another vote for clang-tidy
tehKaiN commentedon Oct 14, 2019
There's an extension for clang-tidy (https://marketplace.visualstudio.com/items?itemName=alesiong.clang-tidy-linter) but apparently it's incomplete (some TODOs) and discontinued (last update about year ago).
So, what's the decision for supporting linting in vscode-cpptools? Is it on the roadmap or should we rely on other extensions?
sean-mcmanus commentedon Oct 14, 2019
KaiN (@tehKaiN) It's not on our extension's roadmap currently.
sean-mcmanus commentedon Oct 21, 2019
It looks like Visual Studio has added support for clang-tidy: https://devblogs.microsoft.com/cppblog/code-analysis-with-clang-tidy-in-visual-studio/ ...but VS doesn't run on Mac/Linux.
Adobe-Android commentedon Jul 14, 2020
I still think that clang-tidy support should be added as a first-party feature, but it looks like progress has been made in this space. I'm happily using the following extension: https://marketplace.visualstudio.com/items?itemName=notskm.clang-tidy
Shatur commentedon Aug 7, 2020
Yes, it would be nice to have because using it as a separate extension (https://github.com/notskm/vscode-clang-tidy for example) is incredibly slow.
https://github.com/clangd/vscode-clangd have support for
clang-tidy, but it not as good as this plugin.Adobe-Android commentedon Aug 13, 2020
I believe it makes sense for Microsoft to start looking at this. The only real alternative will no longer be maintained.
notskm/vscode-clang-tidy#45
Is there anywhere else where we can vote for this feature that would have more visibility?
32 remaining items
Zingam commentedon Nov 17, 2021
It's great that it's happening. But what about CMake support? Even about VS I could only find how to enable it via CMakeSettings.json and nothing about configuration via presets.
sean-mcmanus commentedon Nov 17, 2021
Hristo Hristov (@Zingam) It works with CMake Tools as the configuration provider, i.e. it just hooks into whatever configuration is being used for IntelliSense. We won't have "run on build" for V1, but "Run Code Analysis on All Files" should be exactly the same if you have the configuration provider or compile commands set. Was there additional CMake support you wanted?
Zingam commentedon Nov 27, 2021
Sean McManus (@sean-mcmanus) I was thinking in the context of CMakePresets something like the settings in CMakeSettings.json https://docs.microsoft.com/en-us/cpp/code-quality/clang-tidy?view=msvc-170 It maybe more of a case for the CMake extension.
Let me see how the integration will work when you release it. It got merged right on time. I hope it won't be too long before release so I have the time to gain experience first hand myself. I plan to start integrating clang-tidy and the other tools in our project and I want to "enforce" them on the other developers by some global setting, so I don't have to explain myself over and over to each one of them how to setup and use these tools.
Thank you for your work! I really appreciate it.
sean-mcmanus commentedon Nov 29, 2021
Hristo Hristov (@Zingam) You should be able to enforce the clang-tidy rules with a checked in .clang-tidy file. But if you want to exclude certain folders from being processed (i.e. due to the code not yet conforming to the .clang-tidy rules or owned by other teams), then you'll also need to check in a .vscode/settings.json with
C_Cpp.codeAnalysis.excludeset as well.rickstaa commentedon Nov 30, 2021
Sean McManus (@sean-mcmanus) I tested the feature in the insider version, and it works seamlessly. Thanks a lot to you and the team for implementing this!
heartacker commentedon Nov 30, 2021
yeah, thank you Sean McManus (@sean-mcmanus) and cpptools team for fantastic works . I had been waiting for a long long time.
sean-mcmanus commentedon Nov 30, 2021
This is now available for "preview" in 1.8.0-insiders: https://github.com/microsoft/vscode-cpptools/releases/tag/1.8.0-insiders .
There are some known bugs we're working on fixing still for 1.8.0 (e.g. saving of headers may fail if clang-tidy is processing the header as part of a TU that is different from the "default" TU chosen by IntelliSense). And the clang-tidy quick fixes are postponed till the next release.
Zingam commentedon Nov 30, 2021
+1 for "And the clang-tidy quick fixes are postponed till the next release." - for the quick fixes, not the postponing.