首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Visual Studio代码和Autopep8格式化程序

Visual Studio代码和Autopep8格式化程序
EN

Stack Overflow用户
提问于 2021-05-26 08:12:31
回答 1查看 827关注 0票数 1

我正在尝试将我的python格式化程序设置为autopep8。它已正确安装,但从未在VSCode中作为格式化选项。

代码语言:javascript
复制
"python.formatting.autopep8Path": "C:\\Users\\DawsonSchaffer\\AppData\\Roaming\\Python\\Python39\\Scripts\\autopep8.exe",
    "python.formatting.autopep8Args": [
        "--max-line-length",
        "160",
        "--aggressive",
        "--aggressive",
        "--in-place"
    ],
    "[python]": {
        "editor.defaultFormatter": "autopep8",
    },

我已经改变了所有的设置。然而,我不确定该为autopep8设置什么。

代码语言:javascript
复制
"[python]": {
    "editor.defaultFormatter": "ms-python.python",
},

or

"[python]": {
    "editor.defaultFormatter": "autopep8",
},

此外,autopep8在控制托盘中不可用。

谢谢道森

EN

回答 1

Stack Overflow用户

发布于 2021-05-26 14:00:41

这是为了配置

代码语言:javascript
复制
  "[python]": {
    "editor.defaultFormatter": "ms-python.python"
  },

在settings.json中。

您可以像这样设置以应用autopep8格式:

代码语言:javascript
复制
"python.formatting.provider": "autopep8",
"editor.formatOnSave": true,
"files.autoSave": "afterDelay",

Related official docs

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67697045

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档