Auto-import takes priority over local variable(s) when it is a full match in autocomplete #3157
Replies: 3 comments
-
Looking for feedback from users on the preference of local over exact matches from imported modules. Moving this issue to discussion as an enhancement request for comments and upvotes. |
Beta Was this translation helpful? Give feedback.
-
Another case is when importing from a local sibling script: As you can see here, I have an function called "format_str" in the util.py. When I tried to import it, it only lists it as the first choice when I typed "f" or "fo"; afterwards, it was deprioritized for no reason. This makes even less sense considering the context is already I'm pretty sure this problem (along with the one in OP) didn't exist before. I assume something changed? |
Beta Was this translation helpful? Give feedback.
-
Indeed, very annoying -- you start typing function name, e.g. "print", on "pr" it shows print, you want to press tab, but you already typed "pri" at this moment and it autocompletes with another function. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Environment data
Code Snippet
Repro Steps
Expected behavior
"parse_page" should be the first priority all the time.
Actual behavior
It is the first priority when you have typied p, pa, par, and pars. But once you typed the whole "parse", it will start to show a long list of auto-import, and the desired function will be at the bottom of the list. If you type "parse_", it then immediately begins to become the first again.
Please see this screencap to get better idea:

Comment
I personally think this behavior is very strange. To autocomplete a local variable I have to carefully to not type too much, otherwise after tabbing (muscle memory) it will not only gives me the wrong thing, but also adds something I don't need to
import
.And the fact that autocomplete results could change dramatically before and after typing one more letter seems undesirable from the UX perspective.
Beta Was this translation helpful? Give feedback.
All reactions