如何解决如何在 VS Code 中禁用单行格式?
我的 settings.json
文件是:
{
"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 文件时,函数中的所有属性将自动重新格式化为每行一个属性。如何禁用它,以便函数中的属性跨越特定长度,并在需要时换行?
例如:
# This format
some_func(param1 = 'A',param2 = 'B',param3 = 'C',param4 = 'D')
# Not this format
some_func(
param1 = 'A',param4 = 'D'
)
解决方法
似乎您已经在 VS Code 中安装了 Prettier - Code formatter,删除扩展并使用其他一些 Python 格式化程序。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。