[英]Emacs: Complete base class methods for Python
Is it possible to make either jedi.el
or anaconda-mode
complete base class methods? 是否可以制作
jedi.el
或anaconda-mode
完整的基类方法? For example, when subclassing html.parser.HTMLParser
I expect it to complete the following code at point (1)
(base class has methods like handle_data
or handle_starttag
): 例如,当子类化
html.parser.HTMLParser
我希望它在第(1)
点完成以下代码(基类具有handle_data
或handle_starttag
等方法):
import html.parser
class MyParser(html.parser.HTMLParser):
def handle_ # (1)
I've done some research on this issue and I've found that it is implemented in the latest version of jedi (0.10.0). 我已经对这个问题做了一些研究,我发现它是在最新版本的jedi(0.10.0)中实现的。 Unfortunately, this version is in development state right now and is not available from pip.
不幸的是,这个版本现在处于开发状态,不能从pip获得。 However, many editors use 0.10.0: Atom, VsCode, and even jedi-vim from the author of jedi.
但是,许多编辑使用0.10.0:Atom,VsCode,甚至是来自jedi作者的jedi-vim。
It's easy to update jedi's version in anaconda-mode: https://github.com/nightuser/anaconda-mode . 在anaconda-mode中更新jedi的版本很简单: https : //github.com/nightuser/anaconda-mode 。 The actual change is just a one line.
实际变化只是一行。 The Python part of anaconda-mode must be reinstalled -- simply delete
anaconda-mode
directory. 必须重新安装anaconda-mode的Python部分 - 只需删除
anaconda-mode
目录。 The default location is ~/.emacs.d/anaconda-mode
for Emacs and ~/.emacs.d/.cache/anaconda-mode
for Spacemacs. 默认位置是Emacs的
~/.emacs.d/anaconda-mode
和~/.emacs.d/.cache/anaconda-mode
。
upd: It seems that 0.10.0 will be released soon: https://github.com/davidhalter/jedi/issues/740 . upd:似乎很快就会发布0.10.0: https : //github.com/davidhalter/jedi/issues/740 。
upd2: It was released and know everything works out of the box. upd2:它已经发布,知道一切都开箱即用。 Just remove
anaconda-mode
directory and it'll automatically install latest version. 只需删除
anaconda-mode
目录,它就会自动安装最新版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.