TAB完成时未检测到Jedi Vim Python子类 [英] Jedi Vim Python subclasses are not detected on TAB-completion

查看:91
本文介绍了TAB完成时未检测到Jedi Vim Python子类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题出在Arch(1)& Debian Jessie(2),其中:

The issue is on Arch (1) & Debian Jessie (2) where:

1.

> uname -r
4.0.5-1-ARCH
> echo $PYTHONPATH
/usr/lib/python2.7/

  1. Debian Jessie没有设置PYTHONPATH.

我的vim是用python编译的.

My vim is compiled with python.

:python import sys; print(sys.version)
2.7.10 (default, May 26 2015, 04:16:29)
[GCC 5.1.0]

我尝试了以下Arch Linux软件包:

I tried the following Arch Linux packages:

> pacman -S python2-jedi vim-jedi

完成对类有效,但对子类无效.

completion works on classes but not on the subclasses.

import os          # os is built-in library.
os.                # ycm does not complete members of this class.

我删除了它们并下载了git包.

I removed them and downloaded the git package.

> cd ~/.vim/bundle/jedi-vim/jedi/test/ && ./run.py
Summary: (0 fails of 962 tests) in 18.819s

> cd ../ && ./setup build && ./setup install

同样,补全适用于类,但不适用于子类.

And again, completion works on classes but not on the subclasses.

我以前的问题使我从推荐答案

我刚刚意识到由于我的不理解,我犯了一个错误.我正在尝试通过以下方式导入:

I just realized that I did an error due to my incomprehension. I was trying to import the following way:

当我将ipython与制表符完成一起使用时,这很自然:

Which was natural when I used ipython with tab completion like this:

这是在python脚本中导入模块的错误方法.这是正确的方法:

That is a wrong way to import a module in a python script. This is the right way:

最后,Jedi-Vim插件运行完美.如果不确定与无法进口的商品有关,则可以使用以下方法验证您的进口商品:

Finally, the Jedi-Vim plug-in works perfectly. In case of uncertainty related to unavailable imports you can verify your imports with:

:python import sys; print(sys.path)

然后在运行时添加缺少的目录,以测试缺少的目录是否引起了问题.

And then add the missing directories during the run time to test if their absence was causing the issue.

:python import sys; sys.path.append("/path/to/dir")

在我的情况下, os.py 位于/usr/lib/python2.7/中.

In my case the os.py was located at /usr/lib/python2.7/.

我希望这可以为将来的Jedi-Vim用户澄清这一点.

I hope this clarifies this for the future Jedi-Vim users.

这篇关于TAB完成时未检测到Jedi Vim Python子类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆