【发布时间】:2021-07-28 15:19:04
【问题描述】:
随着我的项目越来越大,我无法在 Vscode 中使用 ctrl + 左键单击(或 F12)转到定义。
我已经测试了一个新的工作区和一个 python 文件。 转到定义功能效果很好。 (即 Python 和 Pylance 适用于小型项目。)
def pp():
print('test')
pp()
另外,我已经通过 Vscode 连接到远程服务器来测试该功能。它在具有更大内存/容量的服务器上运行良好。
在我的本地机器上,我总共有 15.6 GB 内存。 bigger project 打开后,仍有 9 GB 可用内存。
也许它与内存没有直接关系,但实验表明去定义种取决于项目大小:
small project @ local machine: ok
big project @ local machine: failed
big project @ remote server(larger memory): ok
我用的是pylance,是在setting.json里设置的:
"python.languageServer": "Pylance",
"python.jediEnabled": false,
我已经排除了setting.json中所有不必要的文件夹以减少项目大小:
"files.watcherExclude": {
"**/build/**": true,
"**/data/**": true,
"**/output/**": true,
"**/pcdet.egg-info/**": true,
},
但是,当我使用 ctrl 点击时,vscode 会永远加载。
我怎样才能让去定义功能工作?
【问题讨论】:
-
在 VS Code 中,“Go to definition”功能是由“Python”扩展提供的,所以请尝试重新安装此扩展并重新加载 VS Code。 Go to Definition in VS Code
-
我也有同样的问题。我的项目包含一个 Yocto 构建目录,而 Pylance 显然无法处理。
标签: python visual-studio-code vscode-settings remote-debugging