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 注釋前面的空格數量,當為數組時可以動態進行格式對齊
