Title: Issue with autoFormatOnSave and yapf · Issue #124 · microsoft/vscode-python · GitHub
Open Graph Title: Issue with autoFormatOnSave and yapf · Issue #124 · microsoft/vscode-python
X Title: Issue with autoFormatOnSave and yapf · Issue #124 · microsoft/vscode-python
Description: From David Cramer (@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 ...
Open Graph Description: From David Cramer (@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 Sier...
X Description: From David Cramer (@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 Sier...
Opengraph URL: https://github.com/microsoft/vscode-python/issues/124
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Issue with autoFormatOnSave and yapf","articleBody":"_From @dcramer on June 1, 2017 6:44_\n\n## Environment data\r\nVS Code version: 1.12.2 (tried Insiders as well)\r\nPython Extension version: 0.6.4\r\nPython Version: 2.7.13\r\nOS and version: macOS Sierra 10.12.4\r\n\r\n## Actual behavior\r\nUpon save it reformats the file, and does not appear to behave the same as ``yapf -i file``.\r\n\r\nFor example, this content:\r\n\r\n```python\r\nfrom __future__ import absolute_import\r\n\r\nfrom django.db import models\r\nfrom django.utils import timezone\r\n\r\nfrom sentry.db.models import (BoundedBigIntegerField, FlexibleForeignKey,\r\n Model, sane_repr)\r\n\r\n```\r\n\r\nWhen I hit save, it generates invalid Python:\r\n\r\n```python\r\nfrom __future__ import absolute_import\r\n\r\nfrom django.db import models\r\nfrom django.utils import timezone\r\n\r\nfrom sentry.db.models import (\r\n BoundedBigIntegerField, FlexibleForeignKey, Model, sane_repr\r\n)\r\n)\r\n```\r\n\r\n\r\n## Expected behavior\r\n\r\nThe expected output should be:\r\n\r\n```python\r\nfrom __future__ import absolute_import\r\n\r\nfrom django.db import models\r\nfrom django.utils import timezone\r\n\r\nfrom sentry.db.models import (\r\n BoundedBigIntegerField, FlexibleForeignKey, Model, sane_repr\r\n)\r\n```\r\n\r\n## Steps to reproduce: \r\n- add ``editor.formatOnSave`` to workspace settings\r\n- save the file\r\n\r\nEven 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).\r\n\r\nHere is the changeset which we identified this behavior in:\r\n\r\nhttps://github.com/getsentry/sentry/commit/a2587aa38a40c283eb6780e34f9caefa452ccf77\r\n\r\n## Settings \r\nYour launch.json (if dealing with debugger issues): \r\n```json\r\n``` \r\nYour settings.json: \r\n```json\r\n{\r\n \"files.exclude\": {\r\n \"**/*.pyc\": true,\r\n \"static\": true,\r\n \"node_modules\": true,\r\n \"src/sentry/static/dist\": true,\r\n \"env\": true\r\n },\r\n \"prettier.bracketSpacing\": false,\r\n \"prettier.singleQuote\": true,\r\n \"prettier.printWidth\": 90,\r\n \"eslint.options\": {\r\n \"configFile\": \".eslintrc\"\r\n },\r\n \"[javascript]\": {\r\n \"editor.formatOnSave\": true\r\n },\r\n \"[json]\": {\r\n \"editor.formatOnSave\": true\r\n },\r\n \"editor.formatOnSave\": true,\r\n \"python.linting.pylintEnabled\": false,\r\n \"python.linting.flake8Enabled\": true,\r\n \"python.formatting.provider\": \"yapf\",\r\n \"python.pythonPath\": \"${env.WORKON_HOME}/sentry/bin/python\"\r\n}\r\n``` \r\n\n\n_Copied from original issue: DonJayamanne/pythonVSCode#992_","author":{"url":"https://github.com/DonJayamanne","@type":"Person","name":"DonJayamanne"},"datePublished":"2017-11-13T23:04:21Z","url":"https://github.com/microsoft/vscode-python/issues/124"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:65877602-6f01-fff8-ddaf-9539b6f4aae7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9FB0:109EA7:91BE8:BDD10:6AFE2FD1 |
| html-safe-nonce | bda5f5d6da8d5cf4d3aaf2d570e31d3ca583655960ed715713d85cc51e7dc4f0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RkIwOjEwOUVBNzo5MUJFODpCREQxMDo2QUZFMkZEMSIsInZpc2l0b3JfaWQiOiI0NjYwMDE5MDU2NzMwODQ1MTM3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 91153707de7926cc470da8f159a72c03b97c10602f16e096399deb8745d37150 |
| hovercard-subject-tag | issue:273609984 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/vscode-python/124/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c00a6f70b7024815aeb6ac84803e52bd5891aa71b6c504b701cb5e8b3435d13b/microsoft/vscode-python/issues/124 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c00a6f70b7024815aeb6ac84803e52bd5891aa71b6c504b701cb5e8b3435d13b/microsoft/vscode-python/issues/124 |
| og:image:alt | From David Cramer (@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 Sier... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | DonJayamanne |
| hostname | github.com |
| expected-hostname | github.com |
| None | d70e31220a67f6376c108d2416fa8e7df854c1065b1672ab7a88ab6dc3a809e2 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/vscode-python git https://github.com/microsoft/vscode-python.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 106462765 |
| octolytics-dimension-repository_nwo | microsoft/vscode-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | true |
| octolytics-dimension-repository_parent_id | 49946255 |
| octolytics-dimension-repository_parent_nwo | DonJayamanne/pythonVSCode |
| octolytics-dimension-repository_network_root_id | 49946255 |
| octolytics-dimension-repository_network_root_nwo | DonJayamanne/pythonVSCode |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ccb88d9c92abe69245b429398c8a57ae87070c7c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width