Pycharm doesn't detect / suggest modules, classes, or functions to import when typing

When using the other IDEs (webstorm, IDEA, phpstorm), if I start typing a class name, or something I want to import, it will immediately make suggestions of matching symbols to import. Pycharm no longer does this.  Did i accidentally change a setting somewhere, or is this a bug?

10 comments

Code completion suggestions depend on the properly configured project interpreter. What interpreter type do you use? Does the code run without errors? 

In general, check your settings under **File | Settings | Editor | General | Code Completion**, in case you accidentally disabled suggestions.

0

thanks for your reply

i have projects with virtualenv, pipenv, and venv. it doesn't work for any of them. I haven't worked on these projects in any significant capacity this year, so im not sure when it stopped working properly. (possibly related, however, i just started a new project with pipenv and it never seems to detect packages installed via the terminal)

and i double-checked the settings. it's enabled. it's not that it doesn't show suggestions at all. it only does it for builtins as i type. once i type a complete symbol name and pause, it offers to import it

0

oh, and yes, all projects run as expected

0

If it's about built-ins, try File > Invadidate caches/restart, and also Reload interpreter paths in the interpreter settings. Make sure you don't have unnecessary folders (like venv) marked as excluded in project structure.

If nothing helps, try creating a new project with new virtualenv environment and see if the issue is still reproduced. Provide a code snippet, I will try to check locally just in case.

0

Sorry for my delayed response, I was away for a bit.

> If it's about built-ins, 

It's about everything other than built-ins. It doesn't even detect modules in python's stdlib as i type. 

> try File > Invadidate caches/restart, and also Reload interpreter paths in the interpreter settings. Make sure you don't have unnecessary folders (like venv) marked as excluded in project structure.

I have tried all of this. Unfortunately it hasn't helped

> If nothing helps, try creating a new project with new virtualenv environment and see if the issue is still reproduced. Provide a code snippet,

I'm not sure what I could even provide. a minimal setup is an empty file with one installed library

Maybe my problem isn't clear.  I'll provide screenshots with python's behavior (trying to import a class from a django module) and one with javascript's expected behavior (importing an Observable from rxjs) (And like I said, it works properly for Dart, Java, kotlin, etc. I just already had this project open)

In python's behavior, I expect it to offer to import `ModelAdmin` before I finish typing the full class name. You see in the javascript example that a list is shown to import from various sources

0

If you're starting with a blank file, you first need to import a module/library before you can have autocomplete. I don't see keyword "import" in your example.

Please provide steps to reproduce the issue starting from creating a new project.

0

the javascript example also doesn't have an import statement. it's just a blank file.  im not looking for code completion in the traditional sense. im looking for import suggestions, which is what happens when writing java, kotlin, javascript, typescript, php, etc. all of them detect what should be imported

0

Steps to reproduce:

1. Create new project

2. Create python file

3. Type "joi"

 

Expected behavior: a context menu will automatically open with "Import from..." in the title, offering to import "os.path.join()" 

Actual behavior: Nothing happens. Once "join" is fully typed out, alt+enter will display an option to import the function

0

I don't think PyCharm ever offered imports from incomplete entries like "joi". I think it's quite expected that you have to fully type the function/method/class name before IDE can offer you the import. Oh the other hand, for already imported or otherwise referred objects, you will get the suggestion without fully typing it out.

Anyway, you can submit a feature request, I guess.

0

admittedly I haven't started a new python project in a couple years. i've only been maintaining things i'd already created. so it's entirely possible i've expected functionality from the other jetbrains IDEs to exist in pycharm. if that's the case, then yes, i'll file a feature request

but i disagree that it's expected to fully type any symbol because that's the exact problem code completion solves

thank you for all your support

0

Please sign in to leave a comment.