Make automatic adding missing imports smarter
See original GitHub issueScenario 1: Fuzzy Logic
I have a several files containing import {connect} from "react-redux";
. If I use the add missing imports context menu to add the missing import for connect
, the system should realize “react-redux” is far more probable module than “net”, “tls”, and “http2”, which are all recommended higher than “react-redux”, but none of which are used anywhere in my project.
Scenario 2: Respect node conventions
If I have a file ./myfolder/index.ts
, I can import the file with import "./myfolder"
. The system currently resolves missing imports from ./myfolder
as ./myfolder/index.ts
, when it should actually use ./myfolder
.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Tool to automatically add import statements in multiple files
Webstorm / Intellij can do it at least for a single file. SHIFT + ALT + ENTER adds all missing imports in one...
Read more >Auto Import | IntelliJ IDEA Documentation
Always: import statements will be added automatically for all missing classes, methods and fields found in pasted blocks of code.
Read more >Can eclipse be configured to automatically fix missing ...
1. macOS. a) Organize all imports. Command + Shift + O. b) Add import for a specific line.
Read more >Autoimport
Installing · Usage · Features. Add missing imports; Remove unused import statements; Moving the imports to the top · Configuration · References ...
Read more >Auto Import Components In Svelte Kit - Weekly Svelte - YouTube
https://github.com/yuanchuan/sveltekit-autoimporthttps://github.com/yuanchuan/sveltekit-autoimport/issues/3globals.d.ts `declare const ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@minestarks Scenario 1 sounds like it could fall under IntelliCode
Scenario two sounds like #29835, likely a configuration issue. @chriskuech Please share your tsconfig
Sorry, I don’t know off the top of my head - might well be arbitrary at the moment. @mjbvz Scenario 1 seems more in the domain of TS itself rather than IntelliCode as it could be implemented pretty deterministically without machine learning.