python-lsp / python-lsp-server

Fork of the python-language-server project, maintained by the Spyder IDE team and the community
MIT License
1.75k stars 186 forks source link

Processing a lot of unneeded files #504

Closed eyalk11 closed 6 months ago

eyalk11 commented 6 months ago

I noticed that it does process files in packages I never import, and are completely unrlated . So I wonder what is the logic? does it process the entire site-packages? What assures it doesn't cause unneeded load on the CPU ? Is it capped at certain cpu?

2023-12-25 12:55:07,359 Jerusalem Standard Time - DEBUG - pylsp_jsonrpc.endpoint - Sending notification:
$/progress {'token': '0be4e853-dc68-4e61-8d9d-d617bc97f61e', 'value': {'kind': 'report', 'message': 'Working on
site-packages/torch/fx/passes/graph_manipulation.py 703/29825', 'percentage': 2}}
tkrabel commented 6 months ago

This is a rope thing. rope scans all python modules in sys.path (by default) and creates a SQLite database from it, so that autoimport suggestions work (which should work before you imported the library, otherwise the autoimport suggestion would be necessary anymore :)).

eyalk11 commented 6 months ago

And it generates it for every project separately by default as it is saved in .ropeproject under each project. Right? Can you change the default? It takes a lot of processing both in terms of memory(probably - nvim reaches 75 gb ) ,cpu(probably) and disk space(128mb per project).

tkrabel commented 6 months ago

Rope takes the root URI of the language server as the root folder basis. You can set the root URI here via the initialize message