Support automatically updating URL import references when using `new URL(<file>, import.meta.url)`
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- typescript, vscode
調査の方向性
リンクされた Workbench の再現から始め、new URL(<file>, import.meta.url) を使用して、レポートに記載されている既存の動的インポートの更新動作と比較します。移動操作を処理する VS Code のインポート名変更パスを追跡します。どちらか一方の参照ファイルを移動すると、動的インポートの場合と同様に、相対 URL 参照が同じ対象を指すように更新されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Bug Report
🔎 Search Terms
import.meta.url
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about 4.3.0
⏯ Playground Link
💻 Code
Given the following files:
folder/file1.ts
console.log('file1');
export const foo = 42;
different-folder/file2.ts
new URL('../folder/file1.js', import.meta.url);
import('../folder/file1.js');
export const bar = 5;
- Create a new directory
sub-folder/in root - Move
different-folder/intosub-folder/so that the layout becomessub-folder/different-folder/file2.ts - When prompted for "Update imports for 'different-folder'?" click "Yes"
🙁 Actual behavior
sub-folder/different-folder/file2.ts
new URL('../folder/file1.js', import.meta.url);
import('../../folder/file1.js');
export const bar = 5;
The same is true if folder/file1.js is moved to a different location.
🙂 Expected behavior
Similar to the dynamic import, a file reference based on import.meta.url that points to a different TypeScript file should correctly be renamed accordingly.
sub-folder/different-folder/file2.ts
new URL('../../folder/file1.js', import.meta.url);
import('../../folder/file1.js');
export const bar = 5;
VS Code supports the standard dynamic import to handle file renaming. Since import.meta.url and URL are a standard way of resolving files, I would expect VS Code to natively support it as well. For example, Parcel compatibility is implemented in https://github.com/parcel-bundler/parcel/issues/5473, is implemented in Webpack 5 https://github.com/webpack/webpack/pull/11075 and is scheduled for implementation in ESBuild https://github.com/evanw/esbuild/issues/312#issuecomment-800730525
This issue was originally filed at https://github.com/microsoft/vscode/issues/121391
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/TypeScript のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
microsoft/TypeScript#64322 · コメント 2 件 · リアクション 1 件 · 担当者 2 名 ·
-
Possible Improvement
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
microsoft/TypeScript#64278 · コメント 1 件 · リアクション 1 件 ·
-
Docs
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
microsoft/TypeScript#64118 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
microsoft/TypeScript#64094 ·
-
Docs
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
microsoft/TypeScript#63959 · コメント 5 件 ·
microsoft/TypeScript の issue をすべて見る
似ている issue
-
optimization optimization:agents-md-curator
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
githubnext/gh-aw-cao#13143 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
blinklabs-io/bursa#904 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
yanet-platform/ipfw-go#129 ·
-
bug confmap/provider/googlesecretmanagerprovider needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
open-telemetry/opentelemetry-collector-contrib#51273 · コメント 2 件 ·
-
bug: AI Gateway client filter lists "Unknown" twice when NULL and literal Unknown clients coexist オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100