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_sortIncludes ignores .clang-format setting at startup #5068

Closed
johvik opened this issue Mar 6, 2020 · 5 comments
Closed

clang_format_sortIncludes ignores .clang-format setting at startup #5068

johvik opened this issue Mar 6, 2020 · 5 comments
Labels
bug Feature: Code Formatting fixed Check the Milestone for the release in which the fix is or will be available. insiders Currently only repros with our latest Insiders release. Language Service quick fix regression A bug that didn't exist in a previous release
Milestone

Comments

@johvik
Copy link

johvik commented Mar 6, 2020

Type: LanguageService

Describe the bug

  • OS and Version: Fedora 31
  • VS Code Version: 1.42.1
  • C/C++ Extension Version: 0.27.0-insiders2
  • Other extensions you installed (and if the issue persists after disabling them):
  • A clear and concise description of what the bug is.

The Format Document command does not work as exepcted. I can run the command and it does some kind of formatting but the it seems like it isn't using the SortIncludes: true from the .clang-format I have in my repository when clang_format_sortIncludes is the default value or null.

To Reproduce

  1. Prepare a directory with a .clang-format with SortIncludes: true and a source file with #includes that requires sorting
  2. (Not sure if needed, but I've set "C_Cpp.clang_format_path": "/usr/bin/clang-format" in settings.json
  3. Open the directory in vscode (can re-trigger it using Developer: Reload Window)
  4. Run Format Document on the source file
  5. See the includes not being sorted

Expected behavior

Includes to be sorted according to the .clang-format rules when C_Cpp.clang_format_sortIncludesis the default value or null.

Screenshots

Additional context

If I do this the sorting starts to work:

  1. Comment out some setting in settings.json
  2. Save settings.json
  3. Now the formatting works until I restart vscode or reload the window
@sean-mcmanus sean-mcmanus changed the title clang_format_sortIncludes ignores .clang-tidy setting at startup clang_format_sortIncludes ignores .clang-format setting at startup Mar 6, 2020
@sean-mcmanus sean-mcmanus self-assigned this Mar 6, 2020
@sean-mcmanus sean-mcmanus added this to the 0.27.0 milestone Mar 6, 2020
@sean-mcmanus sean-mcmanus added insiders Currently only repros with our latest Insiders release. regression A bug that didn't exist in a previous release labels Mar 6, 2020
@sean-mcmanus
Copy link
Contributor

Thanks a lot for reporting this. It's a regression with 0.27.0-insiders2. We should be able to have a fix for 0.27.0-insiders3.

@sean-mcmanus sean-mcmanus added fixed Check the Milestone for the release in which the fix is or will be available. quick fix labels Mar 6, 2020
@sean-mcmanus sean-mcmanus removed their assignment Mar 6, 2020
@michelleangela
Copy link
Contributor

Is this issue related to the old Clang format 6.0.0 in 0.27.0-insiders2?

@sean-mcmanus
Copy link
Contributor

@michelleangela No. It was a different fix.

@sean-mcmanus
Copy link
Contributor

@oxymoron87
Copy link

oxymoron87 commented Mar 23, 2020

Same issue but now with C_Cpp.clang_format_fallbackStyle or C_Cpp.clang_format_style

VS Code Version: 1.43.1
C/C++ Extension Version: 0.27.0-insiders3

Same workaround still works:

  1. Comment out some setting in settings.json
  2. Save settings.json
  3. Now the formatting works until I restart vscode or reload the window

UPDATE:
Fixed with C/C++ Extension Version: 0.27.0-insiders4

@github-actions github-actions bot locked and limited conversation to collaborators Oct 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Feature: Code Formatting fixed Check the Milestone for the release in which the fix is or will be available. insiders Currently only repros with our latest Insiders release. Language Service quick fix regression A bug that didn't exist in a previous release
Projects
None yet
Development

No branches or pull requests

4 participants