Search code examples
pythonvisual-studio-codepylance

VSCode Pylance highlighting not showing when there is too many files


This is current setting.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 is wokring well by showing description of library like this: enter image description here

however, the problem is it is not highlighting the code properly.

The problem is solved if I delete whole project and highlight comes back. But, whenever number of files in project is getting larger, this happens again.

Any help would be greately appreciate!


Solution

  • Problem is solved by commenting out

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

    in the setting.JSON.

    I am assuming that "diagnosticMode: workspace" makes VScode to look at all of the files in the workspace, which affect pylance highlighting feature.