You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"C_Cpp: Formatting default" not working: editorconfig ignored and clang-format forced anyway #12933
Kons (@KonssnoK) We fixed a bug with .editorconfig formatting with 1.22.11 (and our pending 1.23.1, but the fix is not in 1.23.0) -- are you sure you're on that version? (you may need to reload the extension after it installs the new version). With C_Cpp.loggingLevel set to "Debug" what do you see in the C/C++ logging pane after formatting? Previously, error messages were logged relating to editorconfig.
Kons (@KonssnoK) Yes, I don't repro the issue and your logging doesn't show any errors/issues -- can you send a minimal .editorconfig that repros the issue. There might be something particular that is causing an issue or we may not be handling certain values in the .editorconfig.
It sounds like their might be an additional bug with vcFormat not used by default if there's an .editorconfig, but it needs to have "cpp_" properties in it.
I know it's not minimal..
I can tell you that the 2 settings i noticed were not working were:
when default is selected, brackets are put on new lines (according to default clang-format)
when vcFormat is selected, i noticed the editorconfig was not used because of cpp_new_line_before_else which we use as False when the default is True in vcFormat settings
from the file.
We added this by regenerating the editorconfig via the editorconfig extension while we were trying to understand what was not working (we removed that extension later on)
Kons (@KonssnoK) FYI, it looks like [*.{c, h}] in your .editorconfig is invalid and should be [*.{c,h}]. I don't think would work in 1.21.6 (or 1.23.2).
Hi Kons (@KonssnoK) . This was closed automatically when the associated PR was completed. You wouldn't see this work properly until a new version is released (1.23.2). We've moved to using exactly the same code to parse section patterns as editorconfig-core-js. Once that is available, the pattern you provided containing a space would not work without removing that space.
Opening this for now, so we can close it when the new version is released.
Activity
KonssnoK commentedon Nov 6, 2024
Actually it seems that even by selecting vcFormat as default formatting engine the .editorconfig is ignored.
sean-mcmanus commentedon Nov 6, 2024
Kons (@KonssnoK) We fixed a bug with .editorconfig formatting with 1.22.11 (and our pending 1.23.1, but the fix is not in 1.23.0) -- are you sure you're on that version? (you may need to reload the extension after it installs the new version). With C_Cpp.loggingLevel set to "Debug" what do you see in the C/C++ logging pane after formatting? Previously, error messages were logged relating to editorconfig.
KonssnoK commentedon Nov 6, 2024
pretty sure about the version, yes.
this is what i see when i do "format" with default as selected engine
and instead this is what i see when i format with vcFormat
in both cases editorconfig is ignored
i guess you refer to #12921
sean-mcmanus commentedon Nov 6, 2024
Kons (@KonssnoK) Yes, I don't repro the issue and your logging doesn't show any errors/issues -- can you send a minimal .editorconfig that repros the issue. There might be something particular that is causing an issue or we may not be handling certain values in the .editorconfig.
It sounds like their might be an additional bug with vcFormat not used by default if there's an .editorconfig, but it needs to have "cpp_" properties in it.
KonssnoK commentedon Nov 6, 2024
sure here is the editorconfig that we use:
.editorconfig.txt
I know it's not minimal..
I can tell you that the 2 settings i noticed were not working were:
cpp_new_line_before_elsewhich we use as False when the default is True in vcFormat settingsPS: the issue exists even if you remove
from the file.
We added this by regenerating the editorconfig via the editorconfig extension while we were trying to understand what was not working (we removed that extension later on)
sean-mcmanus commentedon Nov 6, 2024
Kons (@KonssnoK) Okay, thanks. I repro the bug using that .editorconfig file -- the repro occurs when
[*.{c, h}]is used.10 remaining items
sean-mcmanus commentedon Nov 12, 2024
Kons (@KonssnoK) FYI, it looks like
[*.{c, h}]in your .editorconfig is invalid and should be[*.{c,h}]. I don't think would work in 1.21.6 (or 1.23.2).KonssnoK commentedon Nov 13, 2024
oh so spaces are not allowed 🤔
ok thanks i'll check (we haven't changed anything and it was working before)
KonssnoK commentedon Nov 13, 2024
well Sean McManus (@sean-mcmanus) nothing happens even by removing the space. the editorconfig is still ignored.
Actually by setting default formatter engine we go back to clang format being used even if i have "file" as setting and an .editorconfig .
Not sure why Colen Garoutte-Carson (@Colengms) closed this :)
.editorconfig.txt
Colengms commentedon Nov 13, 2024
Hi Kons (@KonssnoK) . This was closed automatically when the associated PR was completed. You wouldn't see this work properly until a new version is released (1.23.2). We've moved to using exactly the same code to parse section patterns as editorconfig-core-js. Once that is available, the pattern you provided containing a space would not work without removing that space.
Opening this for now, so we can close it when the new version is released.
KonssnoK commentedon Nov 13, 2024
thanks Colen Garoutte-Carson (@Colengms), i will close as soon as i can verify the fix!
sean-mcmanus commentedon Dec 6, 2024
Kons (@KonssnoK) Fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/v1.23.2
KonssnoK commentedon Dec 10, 2024
thanks!