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.

Issues trying to auto-import across project boundaries

See original GitHub issue

TypeScript Version: 3.2.2, 3.3.0-rc

Search Terms: autoimport, project references, autocomplete

Code Full minimal repro: https://github.com/MLoughry/typescript-repro

See src/a/lib/index.ts

// If another file in the project already has an import from the other project,
//   then attempting to auto-import `bar` will prompt you to import from 'obj/b/lib'
// If no other import is found within the project, no auto-import suggestions are found
console.log(bar);

Expected behavior: Auto-import should work across project boundaries when an outDir is specified (with or without paths specified in tsconfig.json)

Actual behavior:

  • If there is already a cross-project import within the project: The auto-import attempts to import from the outDir. image
  • If there is no other cross-project import within the project: No import suggestions are found. image

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:4
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
MLoughrycommented, Feb 7, 2019

So, there are two issues here: one when the project has no other reference to the module, and another when it does.

Now that @sheetalkamat has laid them out, I can appreciate the perf implications of trying to fix the first issue (project has no other reference to module). However, would there be any perf implications to fixing the other issue (auto-import resolves to outDir file rather than source file)? It seems like just a matter of mapping the outDir path back to the source path, or am I mistaken?

1reaction
mikeacommented, Feb 13, 2019

A big issue in our source code base as well. One single source tree with lots of tsconfig.json, all extending single tsconfig.base.json with outDir: "build" & composite: true. References everywhere.

In most cases VSC auto-imports from build/ folder. Need to fix imports manually all the time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

VSCode auto-import doesn't use library importPath #9465
In a workspace with both apps and libraries, the auto-import in VSCode doesn't attempt to import from libraries by name, but rather the...
Read more >
Auto Import | IntelliJ IDEA Documentation - JetBrains
Show auto-import tooltip for. Select whether you want the IDE to show popups for Classes and/or for Static methods and fields.
Read more >
Auto import in Visual Studio Code only offering absolute path ...
In Visual Studio Code, menu File β†’ Preferences β†’ Settings β†’ User Settings, "typescript.preferences.importModuleSpecifier": "relative".
Read more >
Repository auto-import - Pluralsight Help Center
Auto-import applies to all repo projects within a repo group. Toggle this feature on or off at any point. ... See more of...
Read more >
MDM Port Status (with file) is showing Empty - SAP Community
Hi, We are having issues with Auto Import. This was working correctly some days back and has suddenly stopped. We restarted MDIS and...
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