microsoft / microsoft/TypeScript

[tsserver] Multi-project goto definition with accurate results

Aperta
#62,080 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Awaiting More Feedback Suggestion
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
2g 4h
PR unite (30g)
132

Descrizione

### 🔍 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 }
```

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

La issue riguarda la gestione di goto-definition su più progetti di tsserver; inizia tracciando come vengono selezionati i progetti che fanno riferimento a un file condiviso. Confronta il risultato corrente con una singola definizione con le definizioni attese dell'esempio, quindi stabilisci una copertura per restituire tutti i risultati rilevanti. Non vengono indicati file o test specifici, quindi individuare l'implementazione e l'area dei test richiede familiarità con il progetto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
typescript
Ambito
developer-experience, tooling
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.