【发布时间】:2020-11-23 21:33:32
【问题描述】:
我已经安装了 black 和 isort 用于 VS Code 中的代码格式化。
黑色有效,而isort 似乎无效。
如果我从命令行运行isort 没有问题。
我尝试修改 setting.json 无济于事。这是最新版本:
{
"window.zoomLevel": 0,
/** "editor.codeActionsOnSave": null */
/** Enable format on save */
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
/** Pyformat use it's own code action to prevent confliction with other tools. */
"source.organizeImports.pyformat": true,
"source.organizeImports.python": true
},
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"python.languageServer": "Pylance",
/** "python.sortImports.path": "isort", */
"python.sortImports.args": [
"-m 3",
"-tc",
"-w 88"
],
"python.formatting.provider": "black",
"python.formatting.blackArgs": [
"--line-length=88"
],
...
有什么建议吗?
【问题讨论】:
标签: python visual-studio-code settings isort