Skip to content

Auto imports prefer a directory barrel over peer import #46817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rezonant opened this issue Nov 13, 2021 · 2 comments
Closed

Auto imports prefer a directory barrel over peer import #46817

rezonant opened this issue Nov 13, 2021 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@rezonant
Copy link

Issue Type: Bug

Given a folder with:

// index.ts
export * from './a';
// a.ts
export class A {}
// b.ts
export class B extends A {}

...an attempt to use auto-import to resolve the reference to A in b.ts will insert:

import { A } from '.';

...instead of the preferred (and the one provided by previous versions of VS Code):

import { A } from './a';
  • I have done an Extension Bisect operation and the issue continued to occur with no extensions running.

A picture of it:
image

Why is this a problem?

  • When outputting CommonJS, the circular dependency can cause the exported symbols to be undefined. When emitting decorator metadata, barrel imports can cause failures due to this.

VS Code version: Code 1.62.2 (3a6960b964327f0e3882ce18fcebd07ed191b316, 2021-11-11T20:56:38.428Z)
OS version: Windows_NT x64 10.0.19043
Restricted Mode: No

System Info
Item Value
CPUs Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz (8 x 3408)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 47.95GB (25.44GB free)
Process Argv --crash-reporter-id 1c87ecb3-4569-4b42-8949-d2f85df04b8b
Screen Reader no
VM 0%
Extensions (27)
Extension Author (truncated) Version
ng-template Ang 13.0.0
vscode-raml blz 3.0.1
vscode-gemfile bun 0.4.2
firecode ChF 1.3.0
gitlens eam 11.6.1
vsc-material-theme Equ 33.2.0
vsc-material-theme-icons equ 1.2.2
vscode-pull-request-github Git 0.32.0
vscode-edit-csv jan 0.6.4
vscode-circleci jva 0.5.0
csharp ms- 1.23.16
vscode-kubernetes-tools ms- 1.3.4
remote-containers ms- 0.205.2
remote-ssh ms- 0.66.1
remote-ssh-edit ms- 0.66.1
remote-wsl ms- 0.58.5
cpptools ms- 1.7.1
hexeditor ms- 1.8.2
vscode-versionlens pfl 1.0.9
material-icon-theme PKi 4.10.0
vscode-yaml red 1.2.0
vscode-spotify shy 3.2.1
slim sia 0.1.2
svg-preview Sim 2.8.3
vsfire tob 1.4.1
vscodeintellicode Vis 1.2.14
vscode-ruby win 0.28.0

(1 theme extensions excluded)

A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythontb:30283811
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
vscod805:30301674
pythonvspyt200:30340761
binariesv615:30325510
vsccppwt:30382697
bridge0708:30335490
dockerwalkthru:30377721
bridge0723:30353136
pythonrunftest32:30373476
pythonf5test824:30373475
javagetstartedt:30391933
pythonvspyt187:30373474
vsqsis300:30386381
vsaa593cf:30376535
vssld246:30386377

@mjbvz mjbvz transferred this issue from microsoft/vscode Nov 16, 2021
@mjbvz mjbvz removed their assignment Nov 16, 2021
@fatcerberus
Copy link

Sounds like #45953.

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Nov 16, 2021
@rezonant
Copy link
Author

Closing in favor of #45953

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants