Repository: TypeScript
Issue: List all possible import paths when autocompleting imports
Labels: Suggestion,Awaiting More Feedback,Domain: Auto-import

# Suggestion

<!--
  Please fill in each section completely. Thank you!
-->

## 🔍 Search Terms

<!--
  💡 Did you know? TypeScript has over 2,000 open suggestions!
  🔎 Please search thoroughly before logging new feature requests as most common ideas already have a proposal in progress.
  The "Common Feature Requests" section of the FAQ lists many popular requests: https://github.com/Microsoft/TypeScript/wiki/FAQ#common-feature-requests

  Replace the text below:
-->

List of keywords you searched for before creating this issue. Write them down here so that others can find this suggestion more easily and help provide feedback.
import autocomplete index.js completion javascript.preferences.importModuleSpecifier

## ✅ Viability Checklist

<!--
   Suggestions that don't meet all these criteria are very, very unlikely to be accepted.
   We always recommend reviewing the TypeScript design goals before investing time writing
   a proposal for ideas outside the scope of the project.
-->
My suggestion meets these guidelines:

* [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code
* [x] This wouldn't change the runtime behavior of existing JavaScript code
* [x] This could be implemented without emitting different JS based on the types of the expressions
* [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
* [x] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).


## ⭐ Suggestion

<!-- A summary of what you'd like to see added or changed -->
When autocomleting imports using intellisense, the list of imports always seems to show only a single path, even when there are multiple paths available.
For instance, if you have file `A.js` exporting a class, and `B.js` importing and exporting that same class (using `export * from "./Network/index.js";` for instance) the autocomplete list only shows either `./A.js` or `./B.js` based on your current location and your `javascript.preferences.importModuleSpecifier` setting in vscode. This makes auto import useless if you prefer to import from a file that isn't listed.

## 📃 Motivating Example / 💻 Use Cases

According to https://dev.to/ndesmic/best-practice-tips-for-writing-your-js-modules-40o5
`import * as foo from "foo.js"` is generally not a very disciplined way to go about things, you should import things by name so that it's very clear which things you actually intended to use.

For this reason, I'd like to import from the file that created the class as much as possible. However, since I am creating a library that I'd like to be able to build into a single file, exporting everything from a single `index.js` is kind of inevitable.
But now every time I try to import a class, it keeps linking to the `index.js` even though I want to link to the actual file.

If the autocomplete list would show all options, you wouldn't have to import files manually for cases where undesired path is chosen.