microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
100.69k stars 12.44k forks source link

Auto-rename imports does not work on TS files when using absolute imports (paths in tsconfig) #59247

Closed aberonni closed 3 months ago

aberonni commented 3 months ago

Type: Bug

Steps to reproduce:

  1. Create a TS project
  2. Configure the TS project to use paths
  3. Import a file with an absolute path using the newly configured paths
  4. Try renaming that file

Expected behaviour:

The editor prompts to rename the import, or renames it directly, based on user settings.

Actual behaviour:

The editor does not rename nor prompt to rename the import.

Additional notes:

This, for me, works fine with relative imports. It only stops working when "paths" are used in the tsconfig.

Possibly related to the following issues:

I have also created a repository to reproduce the issue: https://github.com/aberonni/ts-imports-demo


VS Code version: Code 1.91.0 (ea1445cc7016315d0f5728f8e8b12a45dc0a7286, 2024-07-01T18:53:23.353Z) OS version: Darwin arm64 23.4.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Apple M2 (8 x 2400)| |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
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|5, 4, 4| |Memory (System)|16.00GB (0.06GB free)| |Process Argv|--crash-reporter-id e29a7d95-9a0a-4188-8033-3d197a251a63| |Screen Reader|no| |VM|0%|
Extensions (36) Extension|Author (truncated)|Version ---|---|--- vscode-motivational-gif|abe|1.0.1 cucumberautocomplete|ale|3.0.5 ng-template|Ang|18.1.0 linter-actionlint|ara|0.1.0 markdown-preview-github-styles|bie|2.0.4 vscode-tailwindcss|bra|0.12.5 turbo-console-log|Cha|2.10.4 npm-intellisense|chr|1.4.5 vscode-eslint|dba|3.0.10 dotfiles-syntax-highlighting|dot|0.1.0 xml|Dot|2.5.1 EditorConfig|Edi|0.16.4 prettier-vscode|esb|10.4.0 linter|fna|0.0.19 auto-rename-tag|for|0.1.10 copilot|Git|1.211.0 copilot-chat|Git|0.17.0 vscode-github-actions|git|0.26.3 i18n-ally|lok|2.12.0 dotenv|mik|1.0.1 prettify-json|moh|0.0.3 vscode-docker|ms-|1.29.1 playwright|ms-|1.1.7 debugpy|ms-|2024.6.0 python|ms-|2024.10.0 remote-ssh|ms-|0.112.0 remote-ssh-edit|ms-|0.86.0 remote-explorer|ms-|0.4.3 vsliveshare|ms-|1.0.5932 bun-vscode|ove|0.0.12 vscode-versionlens|pfl|1.14.2 prisma|Pri|5.16.1 quicktype|qui|23.0.170 png-image-diff|ray|0.0.36 vscode-yaml|red|1.15.0 pretty-ts-errors|Yoa|0.5.4 (1 theme extensions excluded)
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vstes627:30244334 vscod805cf:30301675 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 962ge761:30959799 pythongtdpath:30769146 welcomedialog:30910333 pythonnoceb:30805159 asynctok:30898717 pythonregdiag2:30936856 pythonmypyd1:30879173 h48ei257:31000450 pythontbext0:30879054 accentitlementsc:30995553 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 jchc7451:31067544 chatpanelt:31048053 dsvsc021:30996838 jg8ic977:31013176 pythoncenvpt:31062603 a69g1124:31058053 dvdeprecation:31068756 dwnewjupytercf:31046870 2f103344:31071589 legacy_priority:31082724 4930e709:31092288 ```
andrewbranch commented 3 months ago

Duplicate of #59119

typescript-bot commented 3 months ago

This issue has been marked as "Duplicate" and has seen no recent activity. It has been automatically closed for house-keeping purposes.