microsoft / microsoft/TypeScript

Path based Code navigation to /index.js seems broken

オープン
#37,189 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Experience Enhancement Suggestion
主要言語
Go
スター
111k
フォーク
14.4k
平均マージ
1日 19時間
マージ済み PR(30日)
117

説明

  • VSCode Version: 1.42.1
  • OS Version: Mac OS

Steps to Reproduce:
Code navigation seems broken when you import by path and the file is actually in an index.js file.
There are a couple of scenarios relevant to developing in react-native

  1. import from another package in a monorepo import SomeComponent from 'common-lib/Router, when the file is packages/common-lib/src/Router/index.js
  2. import in the same package import SomeComponent from 'modules/Router, when the file is src/modules/Router/index.js
  3. import SomeComponent from 'modules/Router, when the file is not actually index.js src/modules/Router/index.ios.js and src/modules/Router/index.android.js

In general, what works is loading a file name by name (not an index.js file)
What doesn't work is loading a file by path that is actually an index.js, index.native.js, index.ios.js, index.android.js etc file

My code structure is

root
    packages
           mobile
           server
                src
                       server
                       shared
           common-lib

There is some history here that is not ideal. But ok.

packages/server jsconfig.json

{
	"compilerOptions": {
		"target": "es2017",
		"allowSyntheticDefaultImports": false,
		"baseUrl": ".",
		"paths": {
			"common-lib/*": ["../common-lib/*"],
			"mobile/*": ["../mobile/*"],
			"modules/*": ["./src/shared/modules/*"],
			"components/*": ["./src/shared/components/*"],
			"router/*": ["./src/shared/router/*"],
			"server/*": ["./src/server*"],
			"App": ["./src/App"]
		}
	},
	"exclude": ["node_modules", "../../node_modules", "build"]
}

Does this issue occur when all extensions are disabled?: Yes

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

提供されている packages/server jsconfig.json を使って、まず3つのインポートケースを再現します。index.js とプラットフォーム固有の index ファイルも含めます。パスベースのインポートでコードナビゲーションを追跡し、名前付きファイルのインポートと比較します。完了とは、列挙された各シナリオでナビゲーションが解決済みのモジュールに到達することです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, typescript
領域
developer-experience, devtools
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。