TypeScript icon indicating copy to clipboard operation
TypeScript copied to clipboard

when I try to import a module, IntelliSense doesn't show built-in Node.js modules

Open almaceleste opened this issue 1 year ago • 5 comments

Type: Bug

  1. Install extension (Nightly version)
  2. Create .js file
  3. Write import fs from 'node:'

Actual result:
IntelliSense doesn't display built-in modules.

Expected result:
IntelliSense displays a list of built-in modules.

If I install a previous version of the extension (5.5.20240220), everything works as expected.

Extension version: 5.5.20240222 VS Code version: Code 1.86.2 (903b1e9d8990623e3d7da1df3d33db3e42d80eda, 2024-02-13T19:41:37.860Z) OS version: Linux x64 6.5.0-17-lowlatency Modes:

System Info
Item Value
CPUs 12th Gen Intel(R) Core(TM) i9-12900H (20 x 4449)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
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
skia_graphite: disabled_off
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Load (avg) 2, 2, 2
Memory (System) 62.49GB (41.92GB free)
Process Argv --new-window --crash-reporter-id ce669b5b-342e-409e-8360-6778022322a2
Screen Reader no
VM 0%
DESKTOP_SESSION plasmawayland
XDG_CURRENT_DESKTOP KDE
XDG_SESSION_DESKTOP KDE
XDG_SESSION_TYPE wayland
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805:30301674
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:30899288
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
pythontbext0:30879054
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
bf62j303:30959262
pydisww2:30959801
d34g3935:30971562
edj9j583:30969295
a89i1917:30961429
7j2b6412:30969109
e3gdj431:30958358

almaceleste avatar Feb 24 '24 18:02 almaceleste

This did indeed change at some point

RyanCavanaugh avatar Feb 29 '24 22:02 RyanCavanaugh

New version (5.5.20240228) has the same problem.

almaceleste avatar Feb 29 '24 22:02 almaceleste

I can’t reproduce this exactly; i.e., I can’t find an old version where we acquire the Node.js typings from just an incomplete import specifier of "node:". And on currently nightly, as well as the versions mentioned in the issue report, I see that once a complete import specifier is written once in the file, completions do work on subsequent module specifiers.

image image

I think the behavior I’m seeing is working as intended, though it could be a nice enhancement to fetch the Node.js typings as soon as we see node: instead of waiting for a complete match. @almaceleste, can you confirm that things work after one import has been written by hand and left in the file?

andrewbranch avatar May 16 '24 18:05 andrewbranch

Also worth noting that it’s not even every file that needs to have one existing import. As soon as any open file has a complete import from a Node.js builtin, completions work in all other files, even if empty:

image

andrewbranch avatar May 16 '24 18:05 andrewbranch

In newer versions I can't reproduce this problem either. Apparently, the issue can be closed.

almaceleste avatar May 17 '24 02:05 almaceleste