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

Add {rtp}/rplugin/python or python3 to jedi.settings.additional_dynamic_modules #76

Closed
lambdalisue opened this issue Oct 18, 2016 · 11 comments

Comments

@lambdalisue
Copy link

Summary

I would like to enable completion on modules in rplugins.

Might help

https://github.com/lambdalisue/vim-ledi/blob/master/pythonx/ledi/util.py#L49

@zchee
Copy link
Member

zchee commented Oct 18, 2016

/cc @tweekmonster

@tweekmonster
Copy link
Collaborator

What if there's a boolean option called deoplete#sources#jedi#vim_plugin_dev? Then $RUNTIMEPATH/rplugin can be added to sys.path.

@blueyed
Copy link
Collaborator

blueyed commented Oct 18, 2016

FWIW: I've found that symlinking modules into ~/.vim/pythonx/ makes them available in Neovim/Vim, because of the special '_vim_path_' entry at the end of sys.path.
But this does not get picked up / used by the server probably?!

@tweekmonster
Copy link
Collaborator

@blueyed How does _vim_path_ work? I looked at the python client's source but it doesn't appear to do anything and I don't see anything in sys.path that relates to it.

In any case, I think the symlinking trick might be too obscure and not very portable.

@tweekmonster
Copy link
Collaborator

Actually, instead of a variable maybe it would be better if rplugin/python{x,2,3} exists (cwd), just add the directories in &runtimepath to sys.path

tweekmonster added a commit that referenced this issue Oct 19, 2016
@tweekmonster
Copy link
Collaborator

@lambdalisue Could you try the vim-dev branch? The paths should be added automatically if your cwd has a rplugin/python* directory.

@blueyed
Copy link
Collaborator

blueyed commented Oct 19, 2016

@tweekmonster
It is handled through an import hook: https://github.com/neovim/python-client/blob/4dbfbd11a28b765a54928ebe6c6173c336ed841e/neovim/plugin/script_host.py#L228-L232 / https://github.com/neovim/python-client/blob/4dbfbd11a28b765a54928ebe6c6173c336ed841e/neovim/plugin/script_host.py#L237-L251.

But that is not used by the deoplete-jedi server.

But jedi-vim uses it, i.e. <Ctrl-x><Ctrl-o> (with omnifunc=jedi#completions) will use it for completions, but deoplete-jedi won't.

So, instead of manually adding rplugin, the same mechanism could/should be used in the server probably, which would make it behave like other clients/plugins?!

@tweekmonster
Copy link
Collaborator

WTF. When I was searching the code for VIM_SPECIAL_PATH it only jumped between the setup() and teardown() function! Maybe the code didn't load completely in my browser?

It looks like that script is only for the :python* commands, though. It could probably be used on the client side, but wouldn't work for the server since it would need to import from the neovim package. The venv users won't have that, and injecting the client's sys.path into the server wouldn't work for Python 2.

The code in the vim-dev branch essentially does the same thing anyways, albeit less elegantly.

@blueyed
Copy link
Collaborator

blueyed commented Oct 20, 2016

Let's create a PR to discuss it?
https://github.com/zchee/deoplete-jedi/compare/vim-dev?expand=1

@tweekmonster
Copy link
Collaborator

I thought I created a PR 😱 I guess I commented instead.

tweekmonster added a commit that referenced this issue Oct 22, 2016
tweekmonster added a commit that referenced this issue Oct 22, 2016
* Add Neovim rplugin/python* to sys.path

Fixes #76

* Add deoplete#sources#jedi#extra_path option.
@lambdalisue
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants