Visual Studio检查C++的命名约定

yacmzcpb  于 2023-11-21  发布在  其他
关注(0)|答案(1)|浏览(294)

我正在尝试配置我的Visual Studio 022,当我的compagny C++代码规则和命名约定不受尊重时,检查并发出警告。简单的例子是将布尔值前缀为“b”。
第一个月
我试着用.editorconfig配置Visual Studio。我在Microsoft文档中找到了this。我创建了这个:

  1. [*.{cpp,h}]
  2. cpp_naming_rule.booleans_prefixed.symbols = boolean_vars
  3. cpp_naming_rule.booleans_prefixed.style = boolean_style
  4. cpp_naming_symbols.boolean_vars.applicable_kinds = local,parameter,field
  5. cpp_naming_symbols.boolean_vars.applicable_type = bool
  6. cpp_naming_style.boolean_style.capitalization = pascal_case
  7. cpp_naming_style.boolean_style.required_prefix = b
  8. cpp_naming_style.boolean_style.required_suffix =
  9. cpp_naming_style.boolean_style.word_separator =

字符串
但它不起作用。(该文件被考虑在内,我通过修改大小检查).
有任何想法来修复editorconfig或解决我的基本问题?

a9wyjsp7

a9wyjsp71#

在Visual Studio 2022 17.7中引入
1.检查您的Visual Studio版本。尝试重置Visual Studio设置。
1.将.editorconfig放置在与项目相同的文件夹中。然后将.editorconfig添加到项目中。添加->现有项目。
1.检查设置:在C/C++代码样式选项中设置约定,配置linter。建议将其更改为Warning或Error。但这不会影响编译器,只会影响编辑器。白色不明显
x1c 0d1x的数据
1.等待Visual Studio加载.editorconfig。字体从白色变为绿色可能需要很长时间。


相关问题