microsoft / microsoft/TypeScript

[tsserver] Multi-project goto definition with accurate results

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

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

Awaiting More Feedback Suggestion
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

### 🔍 Search Terms

multi project goto definition
tsserver multiple projects
cross project goto
cross project references

### ✅ Viability Checklist

- [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code
- [x] This wouldn't change the runtime behavior of existing JavaScript code
- [x] This could be implemented without emitting different JS based on the types of the expressions
- [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- [x] This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- [x] This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals

### ⭐ Suggestion

Take all projects that references a file into consideration when doing goto definition.

### 📃 Motivating Example

Currently when you are working on shared code that calls or uses code that differs in implementation on the client and server the accuracy of goto definition is not optimal. It will just goto either the client or the server. It would be optimal if all relevant definitions were returned.

### 💻 Use Cases

Example project:
```ts
// shared/shared.ts
let x: Thing; // < goto definition here

// project1/tsconfig.json
...

// project1/thingA.ts
interface Thing { a: string }

// project2/tsconfig.json
...

// project2/thingB.ts
interface Thing { b: number }
```

Currently this is returned (depending on order of project load):
```ts
interface Thing { a: string }
```

What ideally should be returned:
```ts
interface Thing { a: string }
interface Thing { b: number }
```

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

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

はじめの一歩

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

調査の方向性

この issue は tsserver のマルチプロジェクトでの goto-definition 処理を指摘しています。まず、共有ファイルを参照しているプロジェクトがどのように選択されるかを追跡してください。現在の単一定義の結果を、例で期待されている定義と比較し、その後、関連するすべての結果を返すためのカバレッジを確立してください。具体的なファイルやテストは指定されていないため、実装箇所とテスト領域の特定にはプロジェクトへの習熟が必要です。

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

評価

技術スタック
typescript
領域
developer-experience, tooling
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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