You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何让VSCode读取文件中的isort配置?

问题:仓库内的.isort.cfg配置文件无法生效

我希望将isort配置存储在代码仓库中(类似.editorconfig的使用方式),但当前配置未生效。

当前配置详情

VSCode设置(不生效)

"editor.formatOnSave": true,
"[python]": {
    "editor.defaultFormatter": "ms-python.python",
    "editor.codeActionsOnSave": {
        "source.organizeImports": true
    }
},
"python.linting.enabled": true,
"python.formatting.provider": "black",
"isort.check": true,
"isort.logLevel": "debug",
"isort.args": [
    "--settings",
    "/Users/myname/dev/myproject/.isort.cfg",
],

仓库内的.isort.cfg文件内容

[settings]
profile=hug

VSCode保存文件时的isort输出日志

/opt/homebrew/bin/python3 -m isort - --settings /Users/myname/dev/myproject/.isort.cfg --filename /Users/myname/dev/myproject/api/src/models/album.py
CWD Linter: /Users/myname/dev/myproject
/opt/homebrew/bin/python3 -m isort - --settings /Users/myname/dev/myproject/.isort.cfg --check --filename /Users/myname/dev/myproject/api/src/models/album.py
CWD Linter: /Users/myname/dev/myproject

内容的提问来源于stack exchange,提问作者jkulak

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.13 14:25:24