pythonic-emacs / anaconda-mode

Code navigation, documentation lookup and completion for Python.
GNU General Public License v3.0
706 stars 87 forks source link

Anaconda does not retrieve signatures for certain functions, even though jedi does #429

Closed dalanicolai closed 1 year ago

dalanicolai commented 1 year ago

While trying anaconda-mode, I've noticed that it does not retrieve signatures for certain functions. Specifically, I was testing with the following code

import os

os.getenv()

print()

Anaconda mode does retrieve a signature when the cursor is between the parentheses after print, but it does not retrieve the signature when between the parentheses after os-getenv.

Using the jedi api from a terminal, jedi.Script.get_signatures does retrieve signatures for the latter position. Also, does jedi.el.

I could not find a reason for this behavior, also I could not debug it easily. Therefore I am creating this issue.

For completeness, I only see a *anaconda-mode* buffer which contains only the line anaconda_mode port 38419. Also, I am using python version 3.11 (but I think I have also tested it with version 3.9).

Thank you for this otherwise great package!

dalanicolai commented 1 year ago

I have found the culprit. The problem is that the eldoc function in anaconda-mode.py only returns signature data when len(signatures) == 1, while for os.getenv() the length == 2. It would be nice to show both signatures with eldoc.

dakra commented 1 year ago

Thanks