tkf / emacs-jedi

Python auto-completion for Emacs
http://tkf.github.io/emacs-jedi/latest/
666 stars 89 forks source link

Does this plugin support dynamic/runtime auto-completion for type/variable/function names? #351

Closed hongyi-zhao closed 3 years ago

hongyi-zhao commented 3 years ago

Hi,

Does this plugin support dynamic/runtime auto-completion for type/variable/function names, just as the behavior showed by ipython/jupyter?

I focused on dynamic/runtime analysis to offer completion just as the problem discussed here.

More specifically, I want to have the feature/behavior similar to work interactively in the Python Shell. That way it should report what is actually there at runtime, as does any shell like iPython.

I'm not sure whether emacs-jedi has the expected feature mentioned above. Any hints are highly appreciated.

Regards, HY

immerrr commented 3 years ago

Hi,

In general, I don't think so, emacs-jedi only shows what jedi returns to it. jedi focuses first and foremost on the static analysis of the code, and emacs-jedi does not do anything to prepare a runtime environment for dynamic completions. IIRC, there were some corner cases in which jedi executed the code, e.g. for builtin modules, but that was always an exception to the rule, and might have changed.

hongyi-zhao commented 3 years ago

Thanks for your comments. If so, do you know whether there are some other plugins which meet requirements I mentioned here?

immerrr commented 3 years ago

Looks like elpy does that: https://elpy.readthedocs.io/en/latest/ide.html#option-elpy-get-info-from-shell

hongyi-zhao commented 3 years ago

Thank you for letting me know this. I have tried to confirm this feature with its developer.

asmeurer commented 3 years ago

Jedi does have an API for interactive REPL completion https://jedi.readthedocs.io/en/latest/docs/api.html#interpreter