Skip to content
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

Auto import suggestion across referenced composite projects #55879

Closed
ekr3peeK opened this issue Sep 26, 2023 · 3 comments · Fixed by #55955
Closed

Auto import suggestion across referenced composite projects #55879

ekr3peeK opened this issue Sep 26, 2023 · 3 comments · Fixed by #55955
Assignees
Labels
Fix Available A PR has been opened for this issue Needs Investigation This issue needs a team member to investigate its status.

Comments

@ekr3peeK
Copy link

Type: Bug

I am trying to make auto-import suggestions to work when using composite projects via typescripts tsconfig. I've set up a small repo where my issue can be reproduced.

Here is the repo: https://github.com/ekr3peeK/vscode-autoimport-bug

What is happening
When trying to use TestClass in a file inside projectA, I get no auto-import suggestions for the class. Auto-import suggestions work for files from which there was something manually imported at least once inside projectA.

What I am expecting
I am expecting that if projectA is referencing projectB via tsconfig.json, I should receive auto import suggestion for things exported from projectB, even if no file was added beforehand.

If I add the folder of projectB to the includes inside projectA/tsconfig.json auto-import suggestions work, but the projects are not buildable anymore.

VS Code version: Code 1.82.2 (abd2f3db4bdb28f9e95536dfa84d8479f1eb312d, 2023-09-14T05:55:25.390Z)
OS version: Windows_NT x64 10.0.19045
Modes:
Remote OS version: Linux x64 3.10.0-1160.90.1.el7.x86_64
Remote OS version: Linux x64 3.10.0-1160.90.1.el7.x86_64

System Info
Item Value
CPUs AMD FX(tm)-8300 Eight-Core Processor (8 x 3315)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 11.97GB (0.91GB free)
Process Argv --crash-reporter-id 8cc944fc-3735-4ff7-8e33-3469996bd4a8
Screen Reader no
VM 0%
Item Value
Remote SSH: adam.blue.foxgray.com
OS Linux x64 3.10.0-1160.90.1.el7.x86_64
CPUs AMD FX(tm)-6100 Six-Core Processor (6 x 1400)
Memory (System) 7.60GB (4.85GB free)
VM 0%
Item Value
Remote SSH: adam.blue.foxgray.com
OS Linux x64 3.10.0-1160.90.1.el7.x86_64
CPUs AMD FX(tm)-6100 Six-Core Processor (6 x 1400)
Memory (System) 7.60GB (4.85GB free)
VM 0%
Extensions (26)
Extension Author (truncated) Version
mustache daw 1.1.1
LogFileHighlighter emi 2.16.0
mysql-syntax jak 1.3.1
vscode-peacock joh 4.2.2
theme-karyfoundation-themes kar 34.3.0
remote-ssh ms- 0.106.4
remote-ssh-edit ms- 0.86.0
remote-explorer ms- 0.4.1
vscode-intelephense-client bme 1.9.5
vscode-php-getters-setters-cv cve 1.6.1
vscode-eslint dba 2.4.2
githistory don 0.6.20
gitlens eam 14.3.0
vscode-mysql for 0.4.1
gitlab-workflow Git 3.78.0
vscode-test-explorer hbe 2.21.1
path-autocomplete ion 1.25.0
rainbow-csv mec 3.7.1
vscode-html-format moh 0.1.2
vscode-scss mrm 0.10.0
test-adapter-converter ms- 0.1.8
vsliveshare ms- 1.0.5883
vscode-jest Ort 5.2.3
vscode-xml red 0.26.1
gitblame wad 10.5.1
json Zai 2.0.2
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscorecescf:30445987
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
vsclangdc:30486549
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30695312
azure-dev_surveyone:30548225
3biah626:30602489
89544117:30613380
a9j8j154:30646983
showlangstatbar:30737416
03d35959:30757346
pythonfmttext:30731395
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
pythonnosmt12:30797651
pythonidxptcf:30805731
pythonnoceb:30805159
copilotsettingc:30839828
synctok:30821570
dsvsc013:30795093
dsvsc014:30804076
diffeditorv2:30821572
dsvsc015:30845448

@mjbvz mjbvz transferred this issue from microsoft/vscode Sep 26, 2023
@mjbvz mjbvz removed their assignment Sep 26, 2023
@ekr3peeK
Copy link
Author

As it seems this is then a typescript related bug (strange, because other typescript features work, only Vs Code fails to suggest auto imports), I will add, that the typescript version that I am using is 5.2.2, but it seems to work with the nightly version. So maybe this was a bug that was already fixed, but not yet released.

I am still not closing this issue, to get a proper feedback about this, thank you!

@ekr3peeK
Copy link
Author

ekr3peeK commented Sep 30, 2023

Okay, so basically this still has some bugs. Auto-import suggestions now work for files that were present at the time VsCode initialized the typescript project. If I add new exports into files that were present, it works and I get suggestions for the new imports as well.

However, if I create a new file in a referenced project, auto-import won't find the exports of the file, until I use the TypeScript: Reload Project option in vs code.

Just to prevent some follow-up questions, I have watch running with build on the parent project, and declaration files are built for the newly created file. So I am not sure if this is a typescript related bug, or a vs code one, some feedback would be nice.

@rynti
Copy link

rynti commented Apr 10, 2024

Quick question whether this is still going to be considered in the near future, as it was not included in TS 5.4? For our project we have switched to a monorepo setup with TS Composite Projects and auto-imports don't seem reliable in that setup.

Thanks in advance for any update :)

@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fix Available A PR has been opened for this issue Needs Investigation This issue needs a team member to investigate its status.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants