简体   繁体   English

Vscode:由于工作空间大(python),无法定义 go

[英]Vscode: can't go to definition due to large workspace (python)

as my project grows bigger, I can't use ctrl + left click(or F12) to go to definition in Vscode.随着我的项目越来越大,我不能使用 ctrl + 左键单击(或 F12)到go 在 Vscode 中定义

I have tested with a new workspace and a single python file.我已经测试了一个新的工作区和一个 python 文件。 The go to definition feature works well. go 到定义功能运行良好。 ( Ie Python and Pylance are functional for small project. ) 即 Python 和 Pylance 适用于小型项目。

def pp():
    print('test')

pp()

Also, I have tested the feature by connecting to a remote server via Vscode.此外,我通过 Vscode 连接到远程服务器来测试该功能。 It works well on the server, which has much larger memory/ capacity.它在具有更大内存/容量的服务器上运行良好。

On my local machine, I have 15.6 GB memory in total.在我的本地机器上,我总共有 15.6 GB memory。 With the bigger project opened, there is still 9 GB memory free.打开更大的项目后,仍有 9 GB memory 免费。

Maybe it's not directly related to memory but the experiments shows that go to definition kinds of depending on the project size:也许它与 memory 没有直接关系,但实验表明go 定义类型取决于项目大小:

small project @ local machine:                ok
big   project @ local machine:                failed
big   project @ remote server(larger memory): ok

I'm using pylance, which is set in setting.json:我正在使用 pylance,它在 setting.json 中设置:

    "python.languageServer": "Pylance",
    "python.jediEnabled": false,

I have excluded all the uncessary folder in setting.json to reduce the project size:我已经排除了 setting.json 中所有不必要的文件夹以减小项目大小:

"files.watcherExclude": {
    "**/build/**": true,
    "**/data/**": true,
    "**/output/**": true,
    "**/pcdet.egg-info/**": true,
    },

But still, when I click with ctrl, vscode is loading forever.但是,当我点击 ctrl 时,vscode 会永远加载。

How can I get the go to definition feature work?如何让go 定义功能工作?

Man shall avoid storing too much data in the project folder.人应避免在项目文件夹中存储过多的数据。

The problem sticks even when I added all the folder containing massive files to "files.watcherExclude" and "files.exclude" in setting.json即使我在setting.json中将所有包含大量文件的文件夹添加到“files.watcherExclude”和“files.exclude”,问题仍然存在

I finally solved it by move the corresponding folder out of the project.我终于通过将相应的文件夹移出项目来解决它。 Instead I create soft links to them at their original places.相反,我在它们的原始位置创建了指向它们的软链接。

It seems that 20GB files are way too large, even the folder is excluded.似乎 20GB 的文件太大了,甚至排除了文件夹。 And 0.6GB files can't be handled properly either.而且 0.6GB 的文件也不能正确处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM