Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] split jedi into external process #507

Closed
wants to merge 7 commits into from

Conversation

nakamuray
Copy link

Currently, jedi.vim load jedi module using vim's builtin python interpreter, which restrict module explore path only from that python interpreter and virtualenvs created for that interpreter.

So, for example, if I use vim linking with python 2.7 and working on virtualenv created for python 3.4, jedi.vim doesn't list completion candidates installed on the venv.

To fix the problem, I propose splitting jedi loading process into external process and make jedi.vim communicate it through pipes.
Because any python interpreter can execute this external process, user can freely choose which python interpreter to use and get expected completion results.
It assume that "python interpreter user expected" is a command executed as a "python" for now.

I tested this code on linux and osx.
It may cause some problems on windows environment. (cause I have no windows installation, I couldn't test it.)

Previously, jedi.vim load jedi module with vim's python interpreter,
which restrict module explore path only from that python interpreter and
virtualenvs created for that interpreter.

This commit split jedi loading process into external process and
make jedi.vim communicate the process through pipes.
Because any python interpreter can execute this external process,
user can freely choose which python interpreter to use.
@davidhalter
Copy link
Owner

Thanks so much mate! I'm not 100% sure yet what I think about it, but what do you think about davidhalter/jedi#385? Which would generalize this for all kinds of Jedi usages?

@nakamuray
Copy link
Author

I think this discussion forgot the case that user may install and use same python version on multiple places, but yes, it generalized (and complicated) version of mine.
I don't know about cache, though.

@davidhalter
Copy link
Owner

forgot the case that user may install and use same python version on multiple places

What do you mean by that?

I don't know about cache, though.

Caching is an issue, but you wouldn't need to care about it, I could handle that. At the moment it's not handled anyway, so the server wouldn't even need to handle that in the beginning.


Are you interested in creating a general async server for Jedi?

If so one of the biggest issues is actually that sometimes you may want to not call certain methods, because performance would be improved. What would you think about that? Keeping a session?

@nakamuray
Copy link
Author

What do you mean by that?

For example, User, who has /usr/bin/python2.7, also install python 2.7 under his home directory, say, /home/nakamuray/python27/bin/python2.7.
In this case, just switching between python "versions" is not sufficient, as it couldn't distinguish /usr/bin/python2.7 and /home/nakamuray/python27/bin/python2.7.
I thinks server should receive and switch "python interpreter path", not version.

Are you interested in creating a general async server for Jedi?

No. Async, multiple python version jedi server is beyond my needs.
But for that future, I created a new branch, which maintain jedi API compatibility and implement remote object method calling.
https://github.com/nakamuray/jedi-vim/tree/rpc2

@tell-k
Copy link

tell-k commented Dec 13, 2015

+1

@nakamuray
Copy link
Author

open a new PR based on rpc2 branch. close it.

@nakamuray nakamuray closed this Dec 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants