sublimelsp / LSP-pylsp

Convenience package for the Python Language Server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

the autocompletion does not work on 3rd party packages

braindevices opened this issue · comments

for example import can have autocompletion on builtin modules such as time, os, etc. However, it does not work on 3rd party packages at all such as pandas, numpy, lxml, etc. The autocompletion on dot also does not work for those packages. Is the expected?

I did:

pip3 install python-lsp-server[all]

I also installed:

pyls-flake8             0.4.0
pyls-isort              0.2.2
pyls-mypy               0.1.8
pylsp-rope              0.1.8
python-lsp-black        1.0.1

It looks like it only see packages in .cache/sublime-text/Package Storage/LSP-pylsp/lib/python3.8/site-packages Is this expected?

I created a venv, then installed the lxml in that venv, then set the pylsp.plugins.jedi.environment to it, then the autocompletion works on lxml. So I guess it is really the path problem. How do I use the system environment instead? "pylsp.plugins.jedi.environment": "/" does not work neither.

You can extend paths by modifying (appending paths to):

"env": {
"PYTHONPATH": "${sublime_py_files_dir}${pathsep}${packages}",
// Override MYPYPATH to extend the paths that mypy searches when looking for stub files.
// Alternatively create a mypy.ini configuration file at the root of the project with `mypy_path` option set.
// See https://mypy.readthedocs.io/en/stable/config_file.html?highlight=mypy_path#confval-mypy_path
"MYPYPATH": "${sublime_py_files_dir}${pathsep}${packages}"
},

BTW. No need to install any pylsp/pyls related dependencies. The package installs and maintains those itself in its own storage directory.