GitHub - google/yapf: A formatter for Python files
"editor.formatOnSave": true,
"python.formatting.provider": "yapf",
"python.formatting.yapfArgs": [
"--style",
"{BASED_ON_STYLE = pep8, COLUMN_LIMIT = 120, BLANK_LINE_BEFORE_NESTED_CLASS_OR_DEF = true, DEDENT_CLOSING_BRACKETS = true, SPACES_BEFORE_COMMENT = '1,20'}"
],
配置选项参数:
BASED_ON_STYLE 基础样式
INDENT_WIDTH 缩进宽度,默认为4
COLUMN_LIMIT 编辑器列宽
BLANK_LINE_BEFORE_NESTED_CLASS_OR_DEF 在函数和类之间插入空行
DEDENT_CLOSING_BRACKETS 括号缩进换行
SPACES_BEFORE_COMMENT 注释前面的空格数量,当为数组时可以动态进行格式对齐