editorconfig.star¶
Read and set properties in .editorconfig, line by line.
Sections are named as in the file, such as * or *.{js,ts}; use ""
for the preamble before the first section, where root = true goes.
| Function | What it does |
|---|---|
get |
Reads a property. |
set |
Sets a property, adding it, or its section, when missing. |
get¶
Reads a property.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
section |
The section name, such as * or *.go, or "" for the preamble. |
key |
The property name. |
Returns: The value as written, or None.
Example
set¶
Sets a property, adding it, or its section, when missing.
A new property goes after the section's last property; a new section goes at the end of the file. The file is created if needed.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
section |
The section name, or "" for the preamble. |
key |
The property name. |
value |
The value, such as lf or 4; booleans become true and false. |
Returns: True when the file changed.
Example
Used in: editor-defaults