Improve tab autocomplete of import statements

I am mostly working with Typescript and Python, so that I am not aware of the Situation in other languages.

Problem Statement
Autocomplete suggestions for import statements are often wrong if the file to import has not been opened very recently.
This is one of the main pain points of cursor for me, as it is very inefficient to fix import statements that should have been correct initially.
Typical usage pattern: Write some code that uses some class / function to be imported.
Place the cursor in the imports section on top of the file.
Cursor will recognize correctly what classes/functions from the newly written code need to be imported and will provide an autocomplete suggestion of an import statement for those.
Problem: Those statements tend to be wrong, as the file/module path is often hallucinated.
Conversely, especially in typescript, the non-AI autocomplete suggestions when typing something like “import { MyM” to import “MyModule”, will find the correct file where “MyModule” is contained from the file indexing.

Proposed Solution
For imports, integrate the non-AI, deterministic information on importable modules into the AI autocompletion.
I guess the current behavior for getting the autocomplete is:
AI collects context → AI determines what imports are missing → AI generates import statements
Poposal:
AI collects context → AI determines what imports are missing → AI uses the info from file indexing to determine where the entities to import are located → AI generates correct import statements