-
Notifications
You must be signed in to change notification settings - Fork 103
Why EditorConfig uses an INI like format
Waldir Pimenta edited this page Apr 17, 2018
·
5 revisions
The INI file format was chosen for EditorConfig due to its ease of use. Some of the thought process that resulted in the current INI-based EditorConfig format is included below.
- Allow any characters to appear in section names (not just alphanumeric and certain symbols). For example:
[*[1964].txt]
indent_style = space
indent_size = 2
- Allow property declarations outside of section names (at top of file only). For example:
root = true
[*.py]
indent_style = space
indent_size = 4
- Very readable
- Familiar and easy to pick up
- Difficult to mess up (syntax is very simple)
- File structure must be a list of sections (each with name and hash of properties)
- Only string datatypes natively supported for property values
- Easily readable
- Spaces allowed in key and value names
- Many datatypes supported natively (boolean, numeric, strings, lists, hashes)
- May not be as familiar as INI or XML
- The top level structure uses an unordered hash unless
-
is prepended to section names - Section names using symbols (like
*
) must be surrounded by quotes
- root: true
- "*":
- end of line: LF
- "*.py":
- indent style: space
- indent size: 4
- "*.html":
- indent style: space
- indent size: 2
- XML parsers and formatters are readily available
- Format is flexible enough that drastic changes should not be necessary
- Probably somewhat familiar due to the widespread use of XML-based markup
- Not very human readable
- Cumbersome to create and modify due to often verbose syntax
<setting root="true"/>
<pattern glob="*.py">
<indentation style="space" size="4" tabwidth="4"/>
<end_of_line style="LF"/>
</pattern>