这是当前设置.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
}
但是,问题是它没有正确突出显示代码。
如果我删除整个项目并突出显示回来,问题就解决了。但是,每当项目中的文件数量变大时,这种情况就会再次发生。
任何帮助将不胜感激!
通过注释掉问题就解决了
"python.analysis.diagnosticMode": "workspace",
在设置中.JSON。
我假设“diagnosticMode:workspace”使 VScode 查看工作区中的所有文件,这会影响 pylance 突出显示功能。