🌐
EditorConfig
editorconfig.org
EditorConfig
# EditorConfig is awesome: https://editorconfig.org # top-most EditorConfig file root = true # Unix-style newlines with a newline ending every file [*] end_of_line = lf insert_final_newline = true # Matches multiple files with brace expansion notation # Set default charset [*.{js,py}] charset = utf-8 # 4 space indentation [*.py] indent_style = space indent_size = 4 # Tab indentation (no size specified) [Makefile] indent_style = tab # Indentation override for all JS under lib directory [lib/**.js] indent_style = space indent_size = 2 # Matches the exact files either package.json or .travis.yml [{package.json,.travis.yml}] indent_style = space indent_size = 2
file format for defining coding styles (that is supported by various text editor plugins)
Icon for package editorconfig.core
EditorConfig is an open specification and file format for syntax highlighting, text editors and integrated development environment (IDEs) that aims to maintain a consistent coding style, particularly aimed at groups working together. … Wikipedia
Factsheet
Type of format INI configuration file
Standard spec.editorconfig.org
Open format ? Yes
Factsheet
Type of format INI configuration file
Standard spec.editorconfig.org
Open format ? Yes
🌐
Editorconfig
docs.editorconfig.org › en › master › editorconfig-format.html
EditorConfig: EditorConfig File Format
root: special property that should be specified at the top of the file outside of any sections. Set to "true" to stop .editorconfig files search on current file.
🌐
Wikipedia
en.wikipedia.org › wiki › EditorConfig
EditorConfig - Wikipedia
1 week ago - EditorConfig plugins look for a file named .editorconfig in the same directory that contains an existing file, and in parent directories of that one until it hits the root file path (e.g.
🌐
GeeksforGeeks
geeksforgeeks.org › gblog › what-is-editorconfig
What is .editorconfig ? - GeeksforGeeks
July 23, 2025 - If you are using VS Code you can ... files and in every parent directory, but this search can be stopped if it reaches the root file path which can be specified with root=true....
🌐
freeCodeCamp
freecodecamp.org › news › how-to-use-editorconfig-to-standardize-code-styles
Why You Should Use EditorConfig to Standardize Code Styles
September 12, 2024 - You can start by generating the file with your editor, or just create a file named .editorconfig manually. You can copy-and-paste the example from the official website. Alternatively, you can put together all of your preferences and plan the ideal configuration for all files you might interact with. You can work from scratch, or start with mine and make the necessary adjustments. root = true [*] indent_style = space indent_size = 2 end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true curly_bracket_next_line = false spaces_around_operators = true [*.bat] end_of_line = crlf [*.cs] curly_bracket_next_line = true [*.{cpp,cs,gradle,java,kt,py,rs}] indent_size = 4 [*.{js,ts}] quote_type = single [*.md] trim_trailing_whitespace = false [*.tsv] indent_style = tab
🌐
Devhints
devhints.io › apps › editorconfig cheatsheet
editorconfig cheatsheet
# editorconfig.org root = true [*] indent_style = space indent_size = 2 tab_width = 2 end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true
Find elsewhere
🌐
Microsoft Learn
learn.microsoft.com › en-us › visualstudio › ide › create-portable-custom-editor-options
Define Consistent Coding Styles with EditorConfig - Visual Studio (Windows) | Microsoft Learn
To control the scope of your EditorConfig conventions, set the root=true property in the .editorconfig file at the root of your repo or in the directory that your project resides.
🌐
Editorconfig
spec.editorconfig.org › index.html
EditorConfig Specification — EditorConfig Specification 0.17.2 documentation
Non-existing directories are treated ... section names matching the given filename. The search shall stop if an EditorConfig file is found with the root key set to true in the preamble or when reaching the root filesystem directory....
Top answer
1 of 1
1

.editorconfig is a standard file that contains lots of different things related to a solution/project. For example almost all the styling rules and analyzer settings can be stored here. The purpose of this file, as discussed here, is to allow you to standardize your editor configuration (related to styles, naming, formatting, etc) and share it with a team. By putting the configuration into a file, the file can be placed into your source control repository and anyone who pulls down the code will automatically use the configured settings instead of whatever defaults they have set up or VS is using. Basically it forces compliance with company-defined rules.

The file itself can be anywhere in the directory structure up to your project file. For example if your code is at c:\projects\company\myproduct then the file can reside in any directory up to myproduct. If you have different settings for different projects then it makes sense to put it at the project(solution) level. However many companies have standard settings so it is often put into the higher level company directory and all solutions/projects created under that will follow the guidance. So in your specific case put the file anywhere in the directory structure but no deeper than where your project file is. I would recommend with the solution file myself. Restart VS and it'll find it.

Alternatively you can go into the VS options where you configure the formatting rules. It has a button to auto-generate a file based upon your current VS settings. This is generally a faster way of generating the file if you're not comfortable with the format.

The file is hierarchical. By default the IDE will load up every .editorconfig file from the project directory back to the root. This allows you to override settings on a per-project/solution basis. But this can be time consuming so you can optionally add the attribute that marks the config file as root. When the IDE finds a config marked as root it stops walking the directories backwards. If you're using Github repos and plan to share your code then I would recommend you put your config file in the root of your repo and mark it as root so it takes precedence over any other config files.

Note you should not add this file to your project. It is just an extra file (like .gitignore) and doesn't need to be added. It doesn't hurt if you do but it doesn't change anything.

Now, why isn't it working for you. Firstly you should confirm that you're running VS 2022 17.5 Preview 3. This is the first version that supports this feature for C++. If you have a version of VS earlier than that then it won't work for C++ yet. If you are running at least that version then the problem lies elsewhere.

🌐
JetBrains
jetbrains.com › help › rider › Using_EditorConfig.html
Use EditorConfig | JetBrains Rider Documentation
August 10, 2026 - As EditorConfig convention suggests, ... named .editorconfig in the directory of the current file and in all its parent directories until it reaches the root directory or finds an EditorConfig file with root=true....
🌐
Daniel's Programming Blog
blog.danskingdom.com › Reasons-to-use-both-a-local-and-global-editorconfig-file
Reasons to use both a local and global editorconfig file - Daniel Schroeder’s Programming Blog
January 13, 2021 - # This .editorconfig file should live outside of all repositories (and thus not be committed to source control) in # a parent directory, as it includes personal preference presentation settings, like a tab's `indent_size`. # v1.2 root = true [*] indent_style = tab end_of_line = crlf trim_trailing_whitespace = true insert_final_newline = true indent_size = 4 [*.{html,xml,config,json}] indent_size = 2 [*.{md,psd1,pp,yml,yaml}] indent_style = space indent_size = 2
🌐
JetBrains
jetbrains.com › help › resharper › Using_EditorConfig.html
Use EditorConfig | ReSharper Documentation
August 10, 2026 - As EditorConfig convention suggests, ... named .editorconfig in the directory of the current file and in all its parent directories until it reaches the root directory or finds an EditorConfig file with root=true....
🌐
JetBrains
jetbrains.com › help › idea › editorconfig.html
EditorConfig | IntelliJ IDEA Documentation
December 1, 2025 - All you need to do is place an .editorconfig file in the root directory containing the files whose code style you want to define. If you have several code styles in your project (for example, for tests and for production code), you can have ...
🌐
Themightyprogrammer
themightyprogrammer.dev › home › level 0 - coding standard with editorconfig
Level 0 - Coding Standard with EditorConfig | The Mighty Programmer
May 12, 2020 - By design, editor config engine searches for .editorconfig file in the current working directory and its all parents’ directories till it finds .editorconfig with root = true and merges by adding or overriding the configurations of found files.
🌐
Wisdom Geek
wisdomgeek.com › development › programming › editorconfig
Why you should be using an EditorConfig file in your project - Wisdom Geek
October 15, 2023 - Also, you can specify different types of configurations for different file types, and you can even override the settings for a folder by creating another editorconfig in that directory. And if you are looking for more options to configure, there is a wiki with details about the possible ones. # indicate this is the root of the project root = true [*] indent_style = space end_of_line = lf charset = utf-8 trim_trailing_whitespace = true indent_size = 2 [*.html] indent_size = 4 max_line_length = 80 [*.md] trim_trailing_whitespace = falseBash
🌐
Michael Currin
michaelcurrin.github.io › code-cookbook › recipes › other › editor-config.html
EditorConfig | Code Cookbook
root = true [*] indent_style = space indent_size = 4 charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true · Some devs like to set this before going into more formats. I don’t see it as needed. The final newline I handle in my global IDE settings, though other users might not. ... Based on the sample on the EditorConfig homepage.
🌐
GitHub
github.com › editorconfig › editorconfig › issues › 465
`EDITORCONFIG` environmental variable for global config · Issue #465 · editorconfig/editorconfig
April 6, 2022 - Hence my proposition: EDITORCONFIG environmental variable. If it's set to valid file (responsibility of user), plugins will always read (even if root=true in project) the file pointed by it first, then apply settings given by more specific files (like in the root of project).
Author: editorconfig
🌐
Python
bugs.python.org › issue44854
Issue 44854: Add .editorconfig to the root directory - Python tracker
August 6, 2021 - This issue tracker has been migrated to GitHub, and is currently read-only. For more information, see the GitHub FAQs in the Python's Developer Guide · This issue has been migrated to GitHub: https://github.com/python/cpython/issues/89017