yapf icon indicating copy to clipboard operation
yapf copied to clipboard

Respect project editorconfig settings

Open dbarnett opened this issue 5 years ago • 1 comments

If a project directory has a .editorconfig file, yapf should use available style settings from there instead of falling back to hard-coded defaults. For instance, if the project .editorconfig has [*.py] indent_size = 2 then yapf should not indent by 4 (unless it has an explicit indent_width = 4).

Important settings to respect: indent_size, indent_style, and max_line_length.

dbarnett avatar Mar 17 '20 03:03 dbarnett

+1 This is a great feature to have.

From https://github.com/google/yapf#formatting-style, the current behavior looks like:

YAPF will search for the formatting style in the following manner:

Specified on the command line In the [style] section of a .style.yapf file in either the current directory or one of its parent directories. In the [yapf] section of a setup.cfg file in either the current directory or one of its parent directories. In the [tool.yapf] section of a pyproject.toml file in either the current directory or one of its parent directories. In the [style] section of a ~/.config/yapf/style file in your home directory. If none of those files are found, the default style is used (PEP8).

wookayin avatar Nov 03 '21 03:11 wookayin