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

clang-format/tidy version comparisons fail for some builds #12806

Closed
bobbrow opened this issue Oct 4, 2024 · 4 comments · Fixed by #12813
Closed

clang-format/tidy version comparisons fail for some builds #12806

bobbrow opened this issue Oct 4, 2024 · 4 comments · Fixed by #12813
Labels
bug Feature: Code Analysis Related to integration with clang-tidy, cppcheck, cl.exe /analyze, etc. Feature: Code Formatting Language Service
Milestone

Comments

@bobbrow
Copy link
Member

bobbrow commented Oct 4, 2024

Bug Summary

When the user has installed their own version of clang-format or clang-tidy, but has not specified a specific path to the binary, we will compare one from the user's environment with the one we bundle in the extension to see which version is newer.

The logic currently expects the third token in the version query output to be the version number, but this is not always the case. I think a more robust solution might attempt to convert each token to a semver until we find a valid one in case there are more or less tokens in the output.

RE: #12718

@bshoshany
Copy link

bshoshany commented Oct 5, 2024

Thanks for working on this bug! Perhaps simply doing a match for /\d+\.\d+\.\d+/ or a similar regex in the output of clang-tidy --version would be easier?

Also, please consider my comment in #12718 and my related issue #12804.

@bobbrow
Copy link
Member Author

bobbrow commented Oct 7, 2024

It seems the code was being very strict in the token parsing and doesn't like that LLVM is in your string instead of the name of the binary clang-format or clang-tidy. I have a PR that loosens the restrictions and should deal with additional tokens.

@sean-mcmanus sean-mcmanus added this to the 1.22.8 milestone Oct 7, 2024
@sean-mcmanus
Copy link
Collaborator

@bshoshany
Copy link

@sean-mcmanus thanks! I tried it and it does use clang-tidy from the environment instead of the bundled one without specifying the path explicitly. However, the related issue I mentioned, #12804, is not fixed. Even though the correct version is now used, the URL to the docs still has v18.1.6 hard-coded into it. You can see it here:

const primaryDocUri: vscode.Uri = vscode.Uri.parse(`https://releases.llvm.org/18.1.6/tools/clang/tools/extra/docs/clang-tidy/${docPage}`);

So maybe the version that is determined in settings.ts should be cached and then inserted into this URL?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Feature: Code Analysis Related to integration with clang-tidy, cppcheck, cl.exe /analyze, etc. Feature: Code Formatting Language Service
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants