Open Mactarvish opened 6 months ago
Otherwise, if there anyway to let pylance NOT analysis special directory or soft link? I've found that when I create a soft link to my HUGE dataset that causes pylance crash.
There is an exclude option:
https://github.com/microsoft/pyright/blob/main/docs/configuration.md
Additionally see the directions here: https://github.com/microsoft/pylance-release/blob/main/TROUBLESHOOTING.md#pylance-is-crashing
However, we'd rather just fix your memory issue. Can you share your source so we can try and fix the root cause of the problem?
I tried an experiment with a recursive symlinked folder.
Folder looked like this without linking:
- non_linked
- subfolder
- __init__.py
- funcs.py
- __init__.py
- importer.py
Where importer.py looks like this:
from exporter import *
And funcs.py looks like this:
from recursive import *
def foo_func():
return 4
And the __init__.py
files just export all the symbols inside of them.
Then I symlinked non_linked
to exporter
and inside of subfolder
I added a recursive link to non_linked
.
Running this in Pylance I get indexing results like so:
2024-04-25 23:28:56.272 [info] (83551) [IDX(3)] index execution environment file:///home/rich/tests/test_symlinks [found 1218 in 17 files] (14ms)
With output like so:
[BG(1)] binding: file:///home/rich/tests/test_symlinks/non_linked/subfolder/recursive/subfolder/recursive/subfolder/recursive/subfolder/recursive/subfolder/recursive/subfolder/recursive/subfolder/recursive/subfolder/recursive/__init__.py (54ms)
And it chews up memory pretty fast. I'm honestly not sure what eventually stops it. We might hit some maximum import resolution depth.
Thanks for your helps. Seems the key point is not depth of directory but num of files. In the soft link under my workspace there's more than 50000000 .jpg files and cause pylance crash. After move the soft link out of my workspace and reload vscode, pylance reworks well.
Pylance works fine when workspace is small but crashed when huge.
Pylance has crashed. Would you like to try using a Node.js executable to run the language server?
Report issue is
As shown above :
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
But I have 256G memory on my server which is enough for pylance. How to set the max limitation of memory occupy?