首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在VS Code中禁用单行格式?

如何在VS Code中禁用单行格式?
EN

Stack Overflow用户
提问于 2021-02-18 22:44:45
回答 1查看 392关注 0票数 0

我的settings.json文件是:

代码语言:javascript
复制
{
    "python.pythonPath": "E:\\001_Kai_Duplicate\\Venv\\DesktopKubiK_Python37_TimeSeriesForecast\\python.exe",
    "python.pipenvPath": "<your-env-path>",   // if using pipenv
    "editor.formatOnPaste": true,
    "editor.formatOnSave": true,
    "python.formatting.provider": "black",
    "python.formatting.autopep8Path": "<your-env-path>/bin/autopep8",
    "python.formatting.autopep8Args": [
      "--max-line-length",
      "70",
      "--aggressive",
    ],
    "python.linting.lintOnSave": true,
    "python.linting.enabled": true,
    // if using pylint
    "python.linting.pylintEnabled": false,
    "python.linting.pylintPath": "<your-env-path>/bin/pylint",
    "python.linting.pylintArgs": [
      "--load-plugins",
      "pylint_django", // only if you are using django framework
      "--enable=W0614",
      "--enable= W0611"
    ],
    // if using flake8 (uncomment below lines and comment above block of settings of pylint
    // "python.linting.pylintEnabled": false,
    // "python.linting.flake8Enabled": true,
    // "python.linting.flake8Path": "<your-env-path>/bin/flake8",
    // "python.linting.flake8Args": [
    //   "--max-line-length=130"
    // ],
    // to enable sort imports on save
    "editor.codeActionsOnSave": {
      "source.organizeImports": true
    },
    // to add environment vars while opening a new vscode terminal (name:val)
    "terminal.integrated.env.linux": {
      "DJANGO_ENV": "DEV"
    },
    "[python]": {
      "editor.tabSize": 4
    },
    "python.linting.pylamaEnabled": true,
    "prettier.printWidth": 80,
  }

目前,当我保存.py文件时,函数中的所有属性将自动重新格式化为每行一个属性。如何禁用函数中属性将跨越一定长度,并在需要时使用新行?

例如:

代码语言:javascript
复制
# This format
some_func(param1 = 'A', param2 = 'B', param3 = 'C',
          param4 = 'D')

# Not this format
some_func(
    param1 = 'A', 
    param2 = 'B', 
    param3 = 'C',      
    param4 = 'D'
)
EN

回答 1

Stack Overflow用户

发布于 2021-02-28 17:56:40

似乎你已经在VS Code中安装了Prettier - Code格式化程序,删除扩展并使用其他一些python格式化程序。

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

https://stackoverflow.com/questions/66262261

复制
相关文章

相似问题

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