-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 in the latest pre-release version has broken main include sorting #11914
Comments
Hi @benvanik . I'm not able to repro this issue. I get the same results with 1.18.5 and 1.19.2. I'm seeing the later behavior from both versions.
We haven't updated the binary we're shipping for clang-format between these versions.
Do you have other settings set, such as If the difference were due to a change in the behavior of If you're still seeing a difference, can you provide more information, such as the output of the C/C++ output channel, for both repros, having set |
Interesting! I confirmed what you say about the clang-format version being the same in both 1.18.5/1.19.2 on my machine, and invoking from the command line produces the correct results:
I don't have
If I switch to the release version, reload the UI, and format the document it does the right thing. If I switch to the pre-release version, reload the UI, and format it does the incorrect thing. No other settings are changed between them, and it reproduces 100% of the time (I'm sitting and switching versions back and forth), and since the clang-format binary is the same that seems to indicate something else. I don't think I'm taking crazy pills, so maybe this will at least show the difference being the version of the cpptools: bugtest.mp4Is there a way to see the command line being passed to clang-format? Maybe it differs? |
Ahh I was wrong, there is a tiny difference: Release version: note the capitalized drive specifier in the
Pre-release version: note that the driver specifier is now lower-case (
Perhaps a clue? |
Aha. I failed to repro because I wasn't using a source name that matches the header's name. Now I can repro the difference. It does appear to be a difference in casing in the command line, in an |
Thank you for the speedy response! |
Environment
Bug Summary and Steps to Reproduce
Bug Summary:
The clang-format included with the extension incorrectly recognizes the main file for SortIncludes and moves it to the incorrect category. The current release version works correctly.
Steps to reproduce:
.clang-format
file with the given contents:file
style:bugtest.c
with the given contents:Expected behavior (with current release version v1.18.5 and all prior):
Actual behavior (with the pre-release version v1.19.2):
Switching back to the release version and formatting again will resort back to the expected order with the bugtest.h file at the top.
Configuration and Logs
This reproduces with setting
"C_Cpp.clang_format_style": "Google",
and not using the.clang-format
file either.Other Extensions
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: