python autocomplete not working
Answered
I am using Python 3.7 on a MacBook with the latest IntelliJ. AutoComplete works when I use the CTRL + Space bar. I would like for it to work as I type. Is there a way to set this up this way?
Please sign in to leave a comment.
Tick "Show Suggestions as you type" option under Preferences | Editor | General | Code Completion
https://i.imgur.com/azO8dK8.png
That worked.
Thanks,
I have the exact same issue. while I'm typing I don't get any suggestions unless I pres control+space 2 times. If I press it 1 time I get "No suggestion" pop up. If I type it completely and press option+return it suggests the import correctly.
This is my first django project and I'm using:
Python 3.9
Django 4.0.6
pipenv environment.
Hello,
Could you please attach screenshot with IDE window when you press control+space once?
It's like this:
And when I press it twice it's like this:
Hello Amirsadjad,
Is it a project specific or will be reproducible with a new Django project?
Please upload logs folder zipped from ***Help | Collect logs and Diagnostic Data*** to the FTP
https://uploads.jetbrains.com/ and please let me know the filename.
Hello Antonina,
Thank you for the response.
It's not a project specific thing. I created it multiple times and reinstalled the IDE multiple times.
what I'm testing is:
I start writing "HttpResponse" and I expect the IDE to suggest "HttpResponse (django.http)" in the suggestion window and when I click on it I expect it to complete the name and import it like "from django.http import HttpResponse" at the top automatically. but it doesn't. I have to hold the control key and click the space key 2 times for this to work.
I know I have specified the pipenv environment correctly because it works fine after pressing control+space twice and If I type it completely and press option+return it suggests the import correctly.
I have enabled/disabled "Show auto-import tooltip" in the "Autho Import" setting and "Show suggestion as you type" is enabled in the "Code Completion" setting.
I have uploaded the file and this is the info:
Upload id: 2022_07_31_6XmYNo5QgZLezZzhsZnyKe (file: pycharm-logs-20220801-00505414257613088798770171.zip)
Thank you for sharing the detailed explanation.
In PyCharm there are 2 types of completion: basic (for the imported libraries and default Python libraries) and extended - for the libraries which are not imported yet. The behaviour you describe is how it works by design.
You are welcome to submit a feature request at https://youtrack.jetbrains.com/issues/PY in order to enable the extended completion by default. From our point of view it will increase the list of suggestions heavily with the unnecessary references.
By "imported" you mean imported in the .py file like "from django.http import *" or do you mean to install it via pip or pipenv?
This is what confuses me: I am using phpstorm for many years at my job and for php as long as I require a library with composer it's instantly available for auto complete/import as I type it. what is the difference here for python that we can't have that?
It would be nice if we could just enable it in the settings.
>By "imported" you mean imported in the .py file like "from django.http import *" or do you mean to install it via pip or pipenv?
I mean that in the script there is an import statement in the beginning, yes.
Thank you for your feedback, we will take it into consideration.