I'm trying to configure my Visual Studio 022 to check and put warning when my compagny C++ code rules et naming conventions are not respected. The simple example is to prefix boolean with a "b".
bool bFoo = true
I tried to configure Visual Studio with the .editorconfig
. I found this in the Microsoft Documentation. And I created this :
[*.{cpp,h}]
cpp_naming_rule.booleans_prefixed.symbols = boolean_vars
cpp_naming_rule.booleans_prefixed.style = boolean_style
cpp_naming_symbols.boolean_vars.applicable_kinds = local,parameter,field
cpp_naming_symbols.boolean_vars.applicable_type = bool
cpp_naming_style.boolean_style.capitalization = pascal_case
cpp_naming_style.boolean_style.required_prefix = b
cpp_naming_style.boolean_style.required_suffix =
cpp_naming_style.boolean_style.word_separator =
But it does not work. (The file is taken into account, I checked by modifying the indent_size).
Have any ideas to fix the editorconfig or to solve my base problem ?
Check your Visual Studio version. Try resetting Visual Studio Settings.
Place
.editorconfig
in the same folder as the project. Then add.editorconfig
into project. Add -> Existing item.Check the settings: Naming Convention setting in the C/C++ Code Style options and Configure the linter. It is recommended to change it to Warning or Error. But this doesn't affect the compiler, just the editor. White is not obvious
.editorconfig
. It may take a long time until the font changes from white to green.