Autocomplete doesn’t always work on Pycharm

Asked

Viewed 723 times

1

I am starting the use of Pycharm, creating a test with Pygame.

I realize that some Pygame methods do not appear in Pycharm Autocomplete.

For example, if I want to put one pygame.mask.from_surface(), typing pygame.mas nothing comes. But if I complete manually the mask and press the ., then appears correctly the auto-complete from_surface().

Ex:

import pygame
carro = pygame.image.load("imagens/onix.png").convert_alpha()
carro_mask = pygame.mas # aqui já deveria aparece o autocompletar

This also appears for other situations, for example, if I want to use carro.get_rect(), then nothing appears after typing carro.

Here my current configuration:

inserir a descrição da imagem aqui

How to fix this?

  • updated my answer, @Rogério-Dec

2 answers

1

You installed the pygame, right? Have you checked that the python interpreter configuration is correct? I mean, are you pointing to the virtualenv or Docker you’re working on? In the interface settings you can even see the libraries lists in their respective versions.

An additional suggestion would be to reduce the scope of Imports:

from pygame import image

and etc.

UPDATE

I tried to repeat your steps and I had the same problem you found. I did a google search and realized that this is a more recurrent problem to the use of pygame than with Pycharm.

Inclusive, this problem already reported to Pycharm in 2014 and the conclusion was that it was a problem with the library, not with the IDE.

There are attempts to force the Debugger with the Pycharm cache, but also didn’t seem to solve when I applied locally.

Seems hopeless, I’m afraid.

  • The suggestion of reducing the scope I particularly did not find very useful. One of the reasons I use autocomplete Ides (or the reason not to use vim for programming in Java) is to be able to choose not to memorize the name of my class methods, as well as to have access to API documentation without leaving the development window

  • 1

    @Jeffersonquesado the reduction of the scope was just a suggestion of something I usually do and is convention in some companies, for example. But in fact it’s an off-topic discussion. As for answering the question, just stick to the first part.

  • I edited the question and put my current Pycharm configuration.

  • I opened a call in Jetbrains and it’s really a bug and it seems that in the next version it will be ok: https://youtrack.jetbrains.com/issue/PY-30459

0


Browser other questions tagged

You are not signed in. Login or sign up in order to post.