Skip to content

Autoformat on save ignores custom style file #730

Description

@krzysztofwolski

Environment data

VS Code version: 1.20
Python Extension version: 2018.1.0
Python Version: 3.6
OS and version: MacOS Sierra 0.12.6

Actual behavior

First file save with python code formats it to default yapf style. Second save format code to intended, custom style specified in .style.yapf.

To fix this issue added custom argument to workspace settings:

    "python.formatting.yapfArgs": [
        "--style=.style.yapf"
    ]

After that yapf on save works as intended

Expected behavior

After changes in code and saving file, yapf should format code to style described in .style.yapf

Steps to reproduce:

  • open project
  • install and enable yapf
  • enable format on save
  • create .style.yapf file with custom settings (SPLIT_BEFORE_FIRST_ARGUMENT = true)
  • add changes to any .py file
  • save
  • now file is formatted with default style
  • add changes to same file
  • save
  • now file is formatted with custom style

Metadata

Metadata

Labels

area-formattingbugIssue identified by VS Code Team member as probable bug

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions