Skip to content

Implement enhanced integration with clang-tidy #2908

Closed

Description

@ci70

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

Activity

  1. sean-mcmanus commented on Dec 10, 2018

    @sean-mcmanus
    Contributor

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

  2. ci70 commented on Dec 10, 2018

    @ci70
    Author

    Ugh. They don't.

  3. lawsonfulton commented on Jun 21, 2019

    @lawsonfulton

    Here's another vote for clang-tidy

  4. skomik commented on Jul 25, 2019

    @skomik

    And another vote for clang-tidy

  5. tehKaiN commented on Oct 14, 2019

    @tehKaiN

    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?

  6. sean-mcmanus commented on Oct 14, 2019

    @sean-mcmanus
    Contributor

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

  7. sean-mcmanus commented on Oct 21, 2019

    @sean-mcmanus
    Contributor

    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.

  8. Adobe-Android commented on Jul 14, 2020

    @Adobe-Android

    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

  9. Shatur commented on Aug 7, 2020

    @Shatur

    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.

  10. Adobe-Android commented on Aug 13, 2020

    @Adobe-Android

    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?

  11. removed this from the Triage milestone on Oct 18, 2020
  12. 32 remaining items

  13. Zingam commented on Nov 17, 2021

    @Zingam

    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.

  14. sean-mcmanus commented on Nov 17, 2021

    @sean-mcmanus
    Contributor

    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?

  15. added
    fixedCheck the Milestone for the release in which the fix is or will be available.
    on Nov 17, 2021
  16. Zingam commented on Nov 27, 2021

    @Zingam

    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.

  17. sean-mcmanus commented on Nov 29, 2021

    @sean-mcmanus
    Contributor

    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.

  18. rickstaa commented on Nov 30, 2021

    @rickstaa

    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!

  19. heartacker commented on Nov 30, 2021

    @heartacker
    Contributor

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

  20. sean-mcmanus commented on Nov 30, 2021

    @sean-mcmanus
    Contributor

    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.

  21. Zingam commented on Nov 30, 2021

    @Zingam

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

  22. locked and limited conversation to collaborators on Mar 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Feature RequestFeature: Code AnalysisRelated to integration with clang-tidy, cppcheck, cl.exe /analyze, etc.Language ServiceWorks in VSSo we'd need to fix it for VS Code to reach parity.fixedCheck the Milestone for the release in which the fix is or will be available.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions