【发布时间】:2021-03-17 00:07:44
【问题描述】:
我尝试将我的 C++ 格式设置导出到 .editorconfig,但使用我尝试的 2 种方法,配置几乎完全空白,除了简短的注释标题和语言文件格式选择器。
使用这里描述的方法:
https://stackoverflow.com/a/51437947/2033725
生成一个只包含以下内容的编辑器配置:
# 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://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference
[*.cs]
我的项目是c++通过cmake生成的。
我还尝试导航到工具 > 选项 > 文本编辑器 > C/C++ > CodeStyle 并使用设置中的生成 .editorconfig 文件。这给了我以下信息:
# 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
如果我使用项目 -> 添加新项目并选择 .editorconfig(默认),我会得到:
# All files
[*]
indent_style = space
# Xml files
[*.xml]
indent_size = 4
我对我的 c++ 设置进行了一些更改,这些更改在 .editorconfig 领域中是完全可以理解的,甚至还有它的键:
https://docs.microsoft.com/en-us/visualstudio/ide/cpp-editorconfig-properties?view=vs-2019
cpp_indent_namespace_contents cpp_indent_case_labels cpp_indent_case_contents 等等
我的印象是,当不存在现有的 .editorconfig 时,Visual Studio 用于我的格式设置的设置将被导出。这不正确吗?
这是使用 Visual Studio Intellicode 2.2.123.30197 的 Visual Studio 版本 16.7.7
【问题讨论】:
标签: c++ visual-studio-2019 editorconfig