Intellisense / Autocomplete only working after force invoking it twice

Answered

I'm having issues with PyCharm not having a good autocomplete for my imports. All my local packages are not recognized by PyCharm while typing. Pressing cmd+space once shows "No suggestions" and then pressing it again suddendly works and shows all available Imports. 

Other option is to type out the full class name and then doing Alt + Enter and importing what you want.

I'm using PyCharm Professional 2018.2 but honestly this Problem has been ongoing and isn't that Version specific I think. 

Here is a basic example of what I mean: https://gfycat.com/RectangularThisCutworm 

10 comments

Hi,

Have you tried marking the directory with this module as Source Root? (https://www.jetbrains.com/help/pycharm/content-root.html)

It is actually correct that you should press ctrl+double space (or cmd+double space), because then PyCharm is searching everywhere instead of only installed packages and directories marked as Source Root.

0

Yes I have done that. The src directory is marked as a Source Root. And as you can see in the video, PyCharm seems to find the package aswell, if I unmark my src folder I get warnings/errors that it can't find that specific package/class

0

Could you please attach a screenshot of your project tree where the file from the screencast is visible and a screenshot of Project Structure?

0

Can I send you a Private Message with the screenshot somehow? I'm not allowed to share that much out in the open.

0

You can upload it zipped to https://uploads.services.jetbrains.com/. Please then let me know the name of the zip file so I can find it.

0

Hey,

I have uploaded 

"project_structure_from_daniel_pasch_sannapiu.zip"

The folder data_feed isn't opened because it has too many files in it but one of them is called mapping.py which includes the class I'm trying to autocomplete in the video. The selected file is the one I'm writing from in the video.

0

Thanks!

It seems it is correct behaviour in such case. ctrl+space searches current file, to search everywhere your should hit ctrl+double space.

As a workaround you could record a macro for ctrl+double space, assign shortcut to it and then use it. See https://www.jetbrains.com/help/pycharm/using-macros-in-the-editor.html

0

I think we have a misunderstanding. The behaviour I expect is that when I type (without hitting cmd+space at all) I want previews of the classes available in my project)

PHPStorm does exactly that and does it really good. 

0

PyCharm searches the class in the current file and if doesn't find it, you should hit cmd+double space to make it do a wider search. To autocomplete classes from another file/module, you should import it beforehand so that PyCharm knows where to look for the class.

If you would like to be able to have a different behaviour, please feel free to submit a feature request about it to our issue tracker using the link https://youtrack.jetbrains.com/issues/PY and let us know if you need any help.

0

Hmm that's unfortunate. I've created and issue for it and I hope others agree with me, that this is a big missing feature. 

https://youtrack.jetbrains.com/issue/PY-32971

0

Please sign in to leave a comment.