python-language-server
python-language-server copied to clipboard
Use of "pyls.plugins.jedi.environment" for virtualenv completion
I am slightly confused with regards to what the correct use of "pyls.plugins.jedi.environment" and "pyls.plugins.jedi.extra_paths", and how I can use them to get consistent completion both when I have a virtual environment and when I do not have one.
Right now, when using a .venv, I can get completions for pypi modules installed therein by setting "pyls.plugins.jedi.environment": ".venv". Whenever I create a Python file outside of a repository with a .venv folder, completion will stop working for built-in modules. I thought I might be able to use "pyls.plugins.jedi.extra_paths": [".venv"] instead to get both working, but this does not provide completions for pypi moduels installed in the virtual environment.
Is there a configuration combination that will allow me to get completions for modules installed in a .venv folder when available, and still retain completions for globally installed modules when it is not present?
As a temporary fix, I've simple written my config to look for the existence of a '.venv' folder, and use that as my jedi environment if it exists and otherwise, simply use `nil. This works for my particular usecase, but I'd be curious if there is a more elegant way of solving this.