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

Autocomplete does not work on function inputs #1366

Closed
NahsiN opened this issue May 7, 2018 · 6 comments
Closed

Autocomplete does not work on function inputs #1366

NahsiN opened this issue May 7, 2018 · 6 comments

Comments

@NahsiN
Copy link

NahsiN commented May 7, 2018

Summary

Consider the following code

def foo(text):
    a = 'Hello world'
    a.spl
    text.spl

def main():
    foo('Hello World')

Autocomplete works on a.spl suggesting split and splitlines but not on text.spl. Realizing this might be a Jedi issue, I installed Atom along with the autocomplete-python package which also uses Jedi in the background. And in Atom, the autocomplete candidates are bang on which leads me to believe that the underlying issue is perhaps not with Jedi?

Steps to reproduce

In your Emacs editor, type the above code snippet and examine the completion candidates for text.spl

My configuration

OS

Ubuntu 17.10
GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.21)

Result of (elpy-config)

Elpy Configuration

Virtualenv........: None
RPC Python........: 3.6.3 (/usr/bin/python3)
Interactive Python: ipython (/usr/bin/ipython)
Emacs.............: 25.2.2
Elpy..............: 1.17.0
Jedi..............: 0.11.1 (0.12.0 available)
Rope..............: 0.10.5
Importmagic.......: 0.1.7
Autopep8..........: Not found (1.3.5 available)
Yapf..............: 0.15.1 (0.21.0 available)
Syntax checker....: flake8 (/usr/bin/flake8)

Elpy configuration in my init.el

(custom-set-variables
 '(elpy-rpc-backend nil)
 '(elpy-rpc-python-command "python3")
)
(package-initialize)
(elpy-enable)
(elpy-use-ipython)
@galaunay
Copy link
Collaborator

galaunay commented May 8, 2018

Thank you for reporting this.

I was not able to reproduce you issue.
I can get completion for both a.sp and text.sp in your example with elpy.

Could you update jedi to the last version (0.12.0) and see if it makes any difference ?

@NahsiN
Copy link
Author

NahsiN commented May 9, 2018

That's good to know. I just updated my Jedi to 0.12.0 which did not resolve my issue. Hmm what is your elpy-config?

Elpy Configuration

Virtualenv........: None
RPC Python........: 3.6.3 (/usr/bin/python3)
Interactive Python: ipython (/usr/bin/ipython)
Emacs.............: 25.2.2
Elpy..............: 1.17.0
Jedi..............: 0.12.0
Rope..............: 0.10.5
Importmagic.......: 0.1.7
Autopep8..........: Not found (1.3.5 available)
Yapf..............: 0.15.1 (0.21.0 available)
Syntax checker....: flake8 (/usr/bin/flake8)

@NahsiN
Copy link
Author

NahsiN commented May 9, 2018

I just updated my elpy version from 1.17.0 to 1.20.0 and completion for both a.sp and text.sp. I now have a separate question and I don't know if it's a separate issue. Consider the following

import pandas as pd

def foo(df: pd.DataFrame):
    df.he

Does autocompletion work in this case using solely annotations? It should suggest head and it doesn't for me.

@galaunay
Copy link
Collaborator

galaunay commented May 9, 2018

It does not for me as well.
I don't think jedi is able to take information from annotation.
But you should ask directly to the jedi community, they may have a little bit more information.

@NahsiN
Copy link
Author

NahsiN commented May 24, 2018

Btw, I did ask the Jedi community davidhalter/jedi#1120 Seems to be a known issue with pandas.

@galaunay
Copy link
Collaborator

Thanks for the feedback.

If it is a pandas/jedi issue, I am afraid there is not a lot we can do from elpy...
We will have to wait for the next jedi version.

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

No branches or pull requests

2 participants