如何正确配置VSCode以正确格式化python代码

时间:2021-07-16 12:46:01

标签: python visual-studio-code vscode-settings

我在 VSCode 中格式化我的 python 代码时遇到问题,当我指定函数的返回类型时,代码似乎不再被正确识别:

正如您从图片中看到的,代码不再以正确的方式着色,这会影响从函数定义到下一个函数声明的时间点。

如果有帮助,我会留下我的 setting.json 文件:

{
    "python.pythonPath": "Scripts\\python.exe",
    "files.exclude" : {
        "Lib" : true,
        "lib" : true,
        "Include" : true,
        "Scripts" : true,
        "**/__pycache__": true
    }
}

我目前使用的是 Python 3.8.7

0 个答案:

没有答案