microsoft / microsoft/TypeScript

[tsserver] Multi-project goto definition with accurate results

Abierto
#62,080 2 comentarios 0 reacciones 0 asignados Ver en GitHub
Awaiting More Feedback Suggestion
Lenguaje dominante
Go
Estrellas
111k
Forks
14.3k
Merge medio
2 d 4 h
PR fusionados (30 d)
132

Descripción

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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

El issue apunta al manejo de goto-definition en múltiples proyectos de tsserver; empieza rastreando cómo se seleccionan los proyectos que hacen referencia a un archivo compartido. Compara el resultado actual de una sola definición con las definiciones esperadas del ejemplo y, a continuación, establece cobertura para devolver todos los resultados relevantes. No se nombran archivos ni tests específicos, por lo que localizar la implementación y el área de tests requiere familiaridad con el proyecto.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
typescript
Área
developer-experience, tooling
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.