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 and the --Wno-error=unknown option #10072

Closed
H-G-Hristov opened this issue Oct 27, 2022 · 3 comments
Closed

clang-format and the --Wno-error=unknown option #10072

H-G-Hristov opened this issue Oct 27, 2022 · 3 comments
Assignees
Labels
enhancement Improvement to an existing feature Feature: Code Formatting fixed Check the Milestone for the release in which the fix is or will be available. Language Service quick fix
Milestone

Comments

@H-G-Hristov
Copy link

Feature Request

Does the extension support this option:

  --Wno-error=<value>            - If set don't error out on the specified warning type.
    =unknown                     -   If set, unknown format options are only warned about.

By default clang-format will report an error and break any formatting scripts (like the one we use) if it has a unknown option in the config file .clang-format like any new options not available in the currently bundled release.

I think this should be an on-off switch which should be enabled by default.

@H-G-Hristov H-G-Hristov changed the title clang-format and the --Wno-error=unknown clang-format and the --Wno-error=unknown option Oct 27, 2022
@H-G-Hristov
Copy link
Author

H-G-Hristov commented Oct 27, 2022

An example .clang-format:

BasedOnStyle: Google
Standard: c++20
# Available in Clang-Format 15
IndentRequiresClause: true
RequiresClausePosition: OwnLine
# Available in Clang-Format 16
RequiresExpressionIndentation: OuterScope

The last line breaks the format request.

By passing --Wno-error=unknown and ignoring the warnings we can make the above .clang-format work.

@sean-mcmanus
Copy link
Contributor

We've added --Wno-error=unknown as a default. I've created #10102 to track adding a setting to make that configurable.

@sean-mcmanus sean-mcmanus added the fixed Check the Milestone for the release in which the fix is or will be available. label Nov 4, 2022
@sean-mcmanus
Copy link
Contributor

Fixed with 1.13.4 (pre-release): https://github.com/microsoft/vscode-cpptools/releases/tag/v1.13.4

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Improvement to an existing feature Feature: Code Formatting fixed Check the Milestone for the release in which the fix is or will be available. Language Service quick fix
Projects
None yet
Development

No branches or pull requests

2 participants