Skip to content

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

Closed

Description

@bobbrow

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

Activity

  1. added
    Feature: Code Analysis
    on Oct 4, 2024
  2. bshoshany commented on Oct 5, 2024

    @bshoshany

    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.

  3. bobbrow commented on Oct 7, 2024

    @bobbrow
    ContributorAuthor

    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.

  4. bshoshany commented on Oct 9, 2024

    @bshoshany

    Sean McManus (@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?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature: Code AnalysisFeature: Code FormattingLanguage Servicebug

    Type

    No type

    Projects

    • Status
      Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions