I have tried exporting my C++ formatting settings into a .editorconfig but with the 2 methods I have attempted, the config is almost completely blank except for a brief comment header and the language file format selectors.
Using the method described here:
https://stackoverflow.com/a/51437947/2033725
Generates an editorconfig that simply has the following in it:
# Rules in this file were initially inferred by Visual Studio IntelliCode from the D:\ProjectName codebase based on best match to current usage at 12/4/2020
# You can modify the rules from these initially generated values to suit your own policies
# You can learn more about editorconfig here: https://learn.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference
[*.cs]
My project is c++ generated through cmake.
I have also tried navigating to the tools > options > Text Editor > C/C++ > CodeStyle and using the Generate .editorconfig file from settings. This gives me the following:
# Visual Studio generated .editorconfig file with C++ settings.
[*.{c++,cc,cpp,cppm,cxx,h,h++,hh,hpp,hxx,inl,ipp,ixx,tlh,tli}]
vc_generate_documentation_comments = doxygen_slash_star
If I use project -> add new item and select .editorconfig (default) I get this:
# All files
[*]
indent_style = space
# Xml files
[*.xml]
indent_size = 4
I have a number of changes to my c++ settings that vs definitely understands in .editorconfig land and even has keys for it:
https://learn.microsoft.com/en-us/visualstudio/ide/cpp-editorconfig-properties?view=vs-2019
cpp_indent_namespace_contents cpp_indent_case_labels cpp_indent_case_contents etc.
I was under the impression that the settings that visual studio is using for my formatting would be exported when no existing .editorconfig is present. Is that not correct?
This is Visual Studio Version 16.7.7 using Visual Studio Intellicode 2.2.123.30197
You could select the folder path to save .editorconfig
in Tools->Text Editor->C/C++->Code Style->General->Generate .editorconfig file from settings
.
Then you need to compile this project. Then editorconfig will appear in the save path you just set.