question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make automatic adding missing imports smarter

See original GitHub issue

Scenario 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:open
  • Created 5 years ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mjbvzcommented, Feb 12, 2019

@minestarks Scenario 1 sounds like it could fall under IntelliCode

Scenario two sounds like #29835, likely a configuration issue. @chriskuech Please share your tsconfig

0reactions
minestarkscommented, Feb 12, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found