当文件太多时,VSCode Pylance 高亮不显示

问题描述 投票:0回答:1

这是当前设置.JSON

{
    "remote.autoForwardPortsSource": "output",
    "python.analysis.completeFunctionParens": true,
    "python.languageServer": "Pylance",
    "python.analysis.diagnosticMode": "workspace",
    "python.analysis.exclude": [
        "**/data/**",
        "**/tmp/**",
        "**/output/**",
        "**/dataset/**",
        "**/ckpts/**",
        "**/work_dirs/**",
        "**/assets/**",
        "**/docs/**",
        "**/figs/**",
        "**/resources/**",
        "**/.git/**",
        "**/.github/**",
    ],
    "files.watcherExclude": {
        "**/.git/**": true,
        "**/tmp/**": true,
        "**/ouput/**": true,
        "**/others/**": true,
        "**/data/**": true,
        "**/.github/**": true,
    },
    "explorer.autoReveal": false
}

Pylance 通过显示这样的库描述来很好地工作: enter image description here

但是,问题是它没有正确突出显示代码。

如果我删除整个项目并突出显示回来,问题就解决了。但是,每当项目中的文件数量变大时,这种情况就会再次发生。

任何帮助将不胜感激!

python visual-studio-code pylance
1个回答
0
投票

通过注释掉问题就解决了

"python.analysis.diagnosticMode": "workspace",

在设置中.JSON。

我假设“diagnosticMode:workspace”使 VScode 查看工作区中的所有文件,这会影响 pylance 突出显示功能。

© www.soinside.com 2019 - 2024. All rights reserved.