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

TypeScript 5.4 import path completion results in unintended paths #58034

Closed
nekoya opened this issue Apr 2, 2024 · 4 comments
Closed

TypeScript 5.4 import path completion results in unintended paths #58034

nekoya opened this issue Apr 2, 2024 · 4 comments

Comments

@nekoya
Copy link

nekoya commented Apr 2, 2024

Type: Bug

After upgrading TypeScript to 5.4, import path completion did changed its behavior in my project.

TypeScript 5.3

import { foo } from './myModule'

TypeScript 5.4

import { foo } from 'path/to/myModule'

The project defines its baseUrl in tsconfig.json like below.

"baseUrl": "./",

The import path seems to start with the baseUrl, therefore, when I disable baseUrl in tsconfig.json, the import path becomes relative.

This behavior appears when I set TypeScript › Preferences: Import Module Specifier as shortest or project-relative.

I'm sorry, but I haven't been able to create a minimal reproducible case yet. Does anyone know anything about this?

My environment is below.

Version: 1.87.2
Commit: 863d2581ecda6849923a2118d93a088b0745d9d6
Date: 2024-03-08T15:21:31.043Z
Electron: 27.3.2
ElectronBuildId: 26836302
Chromium: 118.0.5993.159
Node.js: 18.17.1
V8: 11.8.172.18-electron.0
OS: Darwin x64 22.6.0

VS Code version: Code 1.87.2 (863d2581ecda6849923a2118d93a088b0745d9d6, 2024-03-08T15:21:31.043Z)
OS version: Darwin x64 22.6.0
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz (16 x 3600)
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: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) 4, 3, 3
Memory (System) 64.00GB (6.75GB free)
Process Argv . --crash-reporter-id b27626fb-3484-4fce-a531-22e8618705e5
Screen Reader no
VM 0%
Extensions: none
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscorecescf:30445987
vscod805cf:30301675
binariesv615:30325510
vsaa593:30376534
py29gd2263:30899288
c4g48928:30535728
azure-dev_surveyone:30548225
2i9eh265:30646982
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
h48ei257:31000450
pythontbext0:30879054
accentitlementst:30995554
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
d34g3935:30971562
fegfb526:30981948
bg6jg535:30979843
ccp2r3:30993541
dsvsc020:30976470
pythonait:31006305
jchc7451:30973076
gee8j676:30988843
dsvsc021:30996838
g1icg217:30999571

@mjbvz mjbvz transferred this issue from microsoft/vscode Apr 2, 2024
@mjbvz mjbvz removed their assignment Apr 2, 2024
@jakebailey
Copy link
Member

Please try a nightly build; I suspect this was fixed by #57973.

@nekoya
Copy link
Author

nekoya commented Apr 3, 2024

Thank you. I confirmed that the behavior has been fixed in 5.5.0-dev.20240329, and the issue was present in 5.5.0-dev.20240328.

I hope it will be backported to 5.4.

@jakebailey
Copy link
Member

Yes, it will: #57976

@terrymun
Copy link

terrymun commented Apr 3, 2024

Thanks for confirming that @jakebailey, I was trying to debug why project-relative set for typescript.preferences.importModuleSpecifier was broken. Downgrading to 5.3.x or bumping to 5.5.0-dev.20240329 fixed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants