Skip to content
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

Implement enhanced integration with clang-tidy #2908

Closed
ci70 opened this issue Dec 9, 2018 · 33 comments · Fixed by #7816
Closed

Implement enhanced integration with clang-tidy #2908

ci70 opened this issue Dec 9, 2018 · 33 comments · Fixed by #7816
Assignees
Labels
Feature: Code Analysis Related to integration with clang-tidy, cppcheck, cl.exe /analyze, etc. Feature Request fixed Check the Milestone for the release in which the fix is or will be available. Language Service Works in VS So we'd need to fix it for VS Code to reach parity.

Comments

@ci70
Copy link

ci70 commented Dec 9, 2018

Implement support for clang extra tools.

  • clang-include-fixer
  • clang-format
  • clang-refactor
  • clang-analyzer
  • clang-tidy
  • clang-rename

EDIT: This issue will just cover clang-tidy. The remaining tools are covered by issue #7276

@sean-mcmanus
Copy link
Collaborator

We support clang-format already. Other VS Code extensions might exist that use the other clang tools.

@ci70
Copy link
Author

ci70 commented Dec 10, 2018

Ugh. They don't.

@lawsonfulton
Copy link

Here's another vote for clang-tidy

@skomik
Copy link

skomik commented Jul 25, 2019

And another vote for clang-tidy

@tehKaiN
Copy link

tehKaiN commented 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
Copy link
Collaborator

@tehKaiN It's not on our extension's roadmap currently.

@sean-mcmanus sean-mcmanus added the Works in VS So we'd need to fix it for VS Code to reach parity. label Oct 21, 2019
@sean-mcmanus
Copy link
Collaborator

sean-mcmanus commented 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.

@Colengms Colengms added this to the Triage milestone Apr 30, 2020
@Adobe-Android
Copy link

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
Copy link

Shatur commented 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
Copy link

Adobe-Android commented 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?

@github-actions github-actions bot modified the milestones: Triage, Backlog Oct 18, 2020
@github-actions
Copy link

This feature request has received enough votes to be added to our backlog.

@rahatchd
Copy link

is the thumbs up reaction enough? bc i'd like to cast a vote for this feature.
specifically clang-tidy.

clang-tidy and cppcheck are the only reasons i still use clion, but i would much rather use vscode

@Kri-Ol
Copy link

Kri-Ol commented Oct 21, 2020

PLease!

@benvanik
Copy link

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

Yeah, and it also has some issues with remote workspaces and is lacking features that would make vscode shine like using CodeActionKind so clang tidy fixes can be applied nicely in the UI. I think clang-tidy fits in line with the cpptools including clang-format support and I'm hopeful a cpptools implementation would use all some of the cool vscode features :)

@mh0s41n
Copy link

mh0s41n commented Jan 4, 2021

I simply don't understand why they don't understand the importance of Clang-tidy. It is as important as C/C++ for Visual Studio Code or Clangd to me. Clang-tidy is the only reason I'm not switching to VS Code.

@sean-mcmanus
Copy link
Collaborator

@mh0s41n This is currently the 5th highest voted feature request, so it seems like it's important to me. Our current focus for 1.2 is on improving stability, testing, and C++20 IntelliSense issues. I'm not sure yet what the feature roadmap is after that.

@ci70
Copy link
Author

ci70 commented Jan 10, 2021

Didn't even know this was upvoted.

@bobbrow bobbrow modified the milestones: Backlog, On Deck Jan 14, 2021
@bobbrow
Copy link
Member

bobbrow commented Jan 14, 2021

Moving this to "On Deck." This feature may need to be split into smaller ones as we might not be able to do all the tools in a single release. clang-tidy will be the highest priority.

@MrSparc
Copy link

MrSparc commented Jan 26, 2021

Great news, clang-tidy will be priority.
ETA?
Thanks

@sean-mcmanus
Copy link
Collaborator

I don't have an ETA yet, but if you see this issue moved to a particular milestone then that milestone will usually have a target release date. We're about to release 1.2.0 in a few days and 1.3.0 is expected to last 6 weeks or so, but I don't think this issue will make that milestone, so it would be 1.4.0 or later, which could be 3 months.

@KaungZawHtet
Copy link

KaungZawHtet commented Jan 27, 2021

Isnt clangd the official extension from LLVM team ? If that so, I wish cooperation between Microsoft and LLVM for compatibility between the two extensions. Reinventing the wheel may not be a good option in every case.

@Zingam
Copy link

Zingam commented 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
Copy link
Collaborator

@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 modified the milestones: 1.8.0, 1.8.0-insiders Nov 17, 2021
@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label Nov 17, 2021
@Zingam
Copy link

Zingam commented Nov 27, 2021

@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
Copy link
Collaborator

@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.

@rickstaa
Copy link

@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
Copy link

yeah, thank you @sean-mcmanus and cpptools team for fantastic works . I had been waiting for a long long time.

@sean-mcmanus
Copy link
Collaborator

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
Copy link

Zingam commented Nov 30, 2021

+1 for "And the clang-tidy quick fixes are postponed till the next release." - for the quick fixes, not the postponing.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Feature: Code Analysis Related to integration with clang-tidy, cppcheck, cl.exe /analyze, etc. Feature Request fixed Check the Milestone for the release in which the fix is or will be available. Language Service Works in VS So we'd need to fix it for VS Code to reach parity.
Projects
None yet
Development

Successfully merging a pull request may close this issue.