Quick fix menu: default to most common import
Opened this issue · 2 comments
When a developer opens the "Quick fix" context menu to import a dependency. VSCode currently defaults to alphabetical order, with external dependencies shown first (as best I can tell).
Libraries with similar variable names will often get preference over the most commonly used import in a project. This request would ensure that the most commonly used import is shown first.
In this example the ./utils/store export useTheme is used throughout the project, the @mui/material export useTheme is not used, but is shown first.
In this example the ~/utils/store export useStore is used throughout the project, the zustand export useStore is not used, but is shown first.

An alternative (or additive) request to this would be showing the number of times an import is used in this menu.
🤖 Thank you for your issue! I've done some analysis to help get you started. This response is automatically generated; feel free to 👍 or 👎 this comment according to its usefulness.
Similar Issues
Here are the most similar issues I found
- (75%) microsoft/typescript#23579: Sort 'Add import to existing' before 'Import additional module' code actions
- (73%) microsoft/typescript#43849: TypeScript Should Prioritize Aliased Imports
- (72%) microsoft/typescript#29877: Order for automatically imported files
- (71%) microsoft/typescript#23279: Suggestion: Organise Imports should sort by import name instead path
- (71%) microsoft/typescript#38743: "Import" suggestions should be before "Change spelling" suggestions
- (71%) microsoft/typescript#29878: Make automatic adding missing imports smarter
- (70%) microsoft/typescript#52872: Typescript: Sort imports in quick fix with imports from node_modules ordered last
- (70%) microsoft/typescript#51155: Auto-import priority rules
- (69%) microsoft/typescript#31710: Prioritise import suggestions from tsconfig alias over external dependencies
- (68%) microsoft/typescript#28619: Suggest import nearest current file.
- (68%) microsoft/typescript#56676: Settings to prefer local import over external import v2
- (67%) microsoft/typescript#41083: Sort import completions by distance from current module
- (67%) microsoft/typescript#29016: With "Organize Imports," sort by the import name rather than by file path
- (67%) microsoft/typescript#14403: Add Sort Imports Quick Fix
- (67%) microsoft/typescript#42615: Prefer type correct import for add missing import for quick fixes
If your issue is a duplicate of one of these, feel free to close this issue. Otherwise, no action is needed.