-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autoformat on save ignores custom style file #730
Comments
Please try using the following format: "python.formatting.yapfArgs": [
"--style", ".style.yapf"
] |
I've faced a similar problem today where "Sort dependencies" would sometimes ignore the local |
@DonJayamanne The problem is not with (Disclaimer: I work with @krzysztofwolski.) |
Apologies, for the misunderstanding. |
I've found a way to reproduce this. It turns out that when you run any of the formatters ( |
This is because in unsaved case file is actually saved in temp folder and then formatted so formatter can't access style rules that are next to the actual file. |
I think we should look for the file, and then apply it. |
Would it be possible to save the temporary file next to the real one so that things just work without VSCode having to reimplement parts of the tool logic? |
Yes. There a small risk that if something fails temp file will remain and appear in the workspace (and possibly the git changes). We could try and locate the file too. |
* Fix pylint search * Handle quote escapes in strings * Escapes in strings * CR feedback * Missing pip * Test * Tests * Tests * Mac python path * Tests * Tests * Test * "Go To Python object" doesn't work * Proper detection and type population in virtual env * Test fixes * Simplify venv check * Remove duplicates * Test * Discover pylintrc better + tests * Undo change * CR feedback * Set interprereter before checking install * Fix typo and path compare on Windows * Rename method * #815 - 'F' in flake8 means warning * 730 - same folder temp * Properly resolve ~ * Test * Test
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:
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:
.style.yapf
file with custom settings (SPLIT_BEFORE_FIRST_ARGUMENT = true)The text was updated successfully, but these errors were encountered: