forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
area-formattingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug
Milestone
Description
From @dcramer on June 1, 2017 6:44
Environment data
VS Code version: 1.12.2 (tried Insiders as well)
Python Extension version: 0.6.4
Python Version: 2.7.13
OS and version: macOS Sierra 10.12.4
Actual behavior
Upon save it reformats the file, and does not appear to behave the same as yapf -i file.
For example, this content:
from __future__ import absolute_import
from django.db import models
from django.utils import timezone
from sentry.db.models import (BoundedBigIntegerField, FlexibleForeignKey,
Model, sane_repr)When I hit save, it generates invalid Python:
from __future__ import absolute_import
from django.db import models
from django.utils import timezone
from sentry.db.models import (
BoundedBigIntegerField, FlexibleForeignKey, Model, sane_repr
)
)Expected behavior
The expected output should be:
from __future__ import absolute_import
from django.db import models
from django.utils import timezone
from sentry.db.models import (
BoundedBigIntegerField, FlexibleForeignKey, Model, sane_repr
)Steps to reproduce:
- add
editor.formatOnSaveto workspace settings - save the file
Even when it doesnt incorrectly format the file into invalid Python, it doesnt seem to respect the configuration within setup.cfg (i still get different output from yapf -i).
Here is the changeset which we identified this behavior in:
Settings
Your launch.json (if dealing with debugger issues):
Your settings.json:
{
"files.exclude": {
"**/*.pyc": true,
"static": true,
"node_modules": true,
"src/sentry/static/dist": true,
"env": true
},
"prettier.bracketSpacing": false,
"prettier.singleQuote": true,
"prettier.printWidth": 90,
"eslint.options": {
"configFile": ".eslintrc"
},
"[javascript]": {
"editor.formatOnSave": true
},
"[json]": {
"editor.formatOnSave": true
},
"editor.formatOnSave": true,
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"python.formatting.provider": "yapf",
"python.pythonPath": "${env.WORKON_HOME}/sentry/bin/python"
}Copied from original issue: DonJayamanne/pythonVSCode#992
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-formattingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable bug