Sometimes you want to use an older version of Jedi in a virtualenv with coc-python, because PyQT5 / PySide2 don't work with Jedi versions >12.1.
Here's the Jedi issue that outlines what happens: davidhalter/jedi#1287.
So, until they fix that, people who work with PyQT5 / PySide2 have to use jedi = "0.12.1".
But that doesn't work with coc-python because the code in this project (forked from the vscode plugin) initializes the jedi environment the wrong way:
class Environment(_BaseEnvironment):
"""
This class is supposed to be created by internal Jedi architecture. You
should not create it directly. Please use create_environment or the other
functions instead. It is then returned by that function.
"""
This, coupled with an API change in Jedi, renders coc-python unable to interface with the legacy Jedi version, since jedi.api.environment.Environment constructor's arguments have changed in the meantime.
But, if we use the recommended way of creating the environment, jedi.api.environment.Environment, the issue goes away and coc-python works properly with both jedi = "0.12.1" and jedi = "0.13.3" (latest).
Sometimes you want to use an older version of Jedi in a virtualenv with coc-python, because PyQT5 / PySide2 don't work with Jedi versions >12.1.
Here's the Jedi issue that outlines what happens: davidhalter/jedi#1287.
So, until they fix that, people who work with PyQT5 / PySide2 have to use
jedi = "0.12.1"
. But that doesn't work with coc-python because the code in this project (forked from the vscode plugin) initializes the jedi environment the wrong way:which is clearly against the recommendation in the Jedi project
This, coupled with an API change in Jedi, renders coc-python unable to interface with the legacy Jedi version, since
jedi.api.environment.Environment
constructor's arguments have changed in the meantime.But, if we use the recommended way of creating the environment,
jedi.api.environment.Environment
, the issue goes away and coc-python works properly with bothjedi = "0.12.1"
andjedi = "0.13.3"
(latest).This is the change:
I'll put up a pull request with this fix right away.