vs code, language service, suggestions, auto complete, import, symbol, nearest current file.
In VS Code the auto complete dropdown for auto importing seems to have a random order. I think the user experience could be improved by ordering the exported symbols in the dropdown in order of how close the file path is to your current file path.
See the example directory structure below.
Say that both moduleA/constants.ts and moduleB/constants.ts export a variable like foobar. When I type foobar in moduleA/index.ts it's likely that I'm trying to auto import foobar from moduleA/constants.ts`.
In the current approach the dropdown suggests foobar from both moduleA/constants.ts and moduleB/constants.ts, however, the order doesn't seem to be guaranteed so sometimes it will suggest moduleB's foobar first and other times moduleA's foobar.
I think this could be improved by ordering suggestions in terms of how close their source file path is to the current file path, such that moduleA's foobar always appears before moduleB's foobar when I'm in moduleA/index.ts. For the sake of completeness, I think it should show moduleB's foobar first when I'm in moduleB/index.ts.
I hope I've explained that clearly enough.
My suggestion meets these guidelines:
I agree, this is currently very frustrating for me. In a project I'm working on, we utilize a state management library, and end up having many functions that share the same name in many different modules, but the function in the closest module is the one I want 99.99% of the time. Unfortunately, the language service always seems to suggest the modules I don't want, and the closest module is buried at the end of the list quite often. Looking at the picture below, no human would order the suggestions that way.

Order isn't random - it's nonrelative first, then relative. Within those, they're sorted by number of path segments (and then lexicographically within that). Generally speaking, in many cases, the import directly from a package (vs some deep, relative import) is usually correct; but I assume you're using the baseUrl compiler option to give a bunch of your files nonrelative names?
In my case, yes, I am using baseUrl. Maybe the ordering should depend upon that setting?
Really want this. TS' auto import sometimes even introduce cyclic dependencies, if a directory re-exports stuff within index.ts.
Most helpful comment
I agree, this is currently very frustrating for me. In a project I'm working on, we utilize a state management library, and end up having many functions that share the same name in many different modules, but the function in the closest module is the one I want 99.99% of the time. Unfortunately, the language service always seems to suggest the modules I don't want, and the closest module is buried at the end of the list quite often. Looking at the picture below, no human would order the suggestions that way.