microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.51k stars 1.55k forks source link

Links to docs for clang-tidy checks use incorrect version #12804

Open bshoshany opened 2 weeks ago

bshoshany commented 2 weeks ago

Environment

Bug Summary and Steps to Reproduce

When using clang-tidy, diagnostic messages displayed in the problems pane contain helpful links to the check's documentation on llvm.org. However, the link is to a version that does not match the version of clang-tidy being used. I noticed this after upgrading LLVM to v19.1.0. This version introduced some new clang-tidy checks, such as use-std-min-max, which did not exist in previous versions. But the link provided by the extension is:

https://releases.llvm.org/18.1.6/tools/clang/tools/extra/docs/clang-tidy/checks/readability/use-std-min-max.html

This link does not work, because it links to the page for v18.1.6, which did not have this particular check. The correct link is:

https://releases.llvm.org/19.1.0/tools/clang/tools/extra/docs/clang-tidy/checks/readability/use-std-min-max.html

Which does work. I'm not sure why it links to 18.1.6, because the bundled version is actually 18.1.8, but in any case I think the extension needs to do clang-tidy --version on whatever binary it's using, and then provide a link to the correct version.

Configuration and Logs

N/A

Other Extensions

No response

Additional context

No response

bshoshany commented 1 week ago

Update (related to issue #12806 and PR #12813): Even though the clang-tidy version is now correctly determined, the URL to the docs still has v18.1.6 hard-coded into it. You can see it here:

https://github.com/microsoft/vscode-cpptools/blob/292d84f55af235b7902daae4d29a6ae0ca4a8d50/Extension/src/LanguageServer/codeAnalysis.ts#L381

So maybe the version that is determined in settings.ts should be cached and then inserted into this URL? I'm talking specifically about this function that was modified in PR #12813:

https://github.com/microsoft/vscode-cpptools/blob/292d84f55af235b7902daae4d29a6ae0ca4a8d50/Extension/src/LanguageServer/settings.ts#L273-L320

Seems like an easy enough fix, if I had time I would have just written my own PR, but this is a very busy month 😞

sean-mcmanus commented 3 days ago

This should be fixed by https://github.com/microsoft/vscode-cpptools/pull/12834 for 1.23.0.

bshoshany commented 3 days ago

@sean-mcmanus That's great, thanks! Although, if I understand correctly, now v19.1.0 is hard-coded into the script, so as soon as a new version (e.g. 19.2.0 or 20.1.0) is released with some new checks, the URL will be incorrect again ☹