microsoft / microsoft/TypeScript
Expose `textChanges.ChangeTracker` for public API
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Go
- Estrellas
- 111k
- Forks
- 14.4k
- Merge medio
- 1 d 19 h
- PR fusionados (30 d)
- 117
Descripción
Suggestion
I'm not sure how such requests as this one suits into TypeScript repo, but I've seen such requests earlier so decided to put another one!
Motivation: Currently it's very unclear for new developers how to contribute new code actions (refactorings / quick fixes: getEditsForRefactor / getCodeFixesAtPosition) with current plugins API. While factory API is exposed AFAICS the only way to convert nodes to actual changes is ts.createPrinter().printNode, which makes passed in formatOptions useless (just always inserting semicolons is already too annoying). I don't see a reason why don't let other developers to build their own code actions in the same way as built-in bulit.
Of course I've already seen a lot of plugins using in our days, most of them are using constructor and with along with these methods: insertNodeAt, replaceNodeRange, delete and a few others. With types exposed it would be easier to use language service methods that receive formatOptions.
🔍 Search Terms
Language Service Plugins API
List of keywords you searched for before creating this issue. Write them down here so that others can find this suggestion more easily and help provide feedback.
✅ Viability Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
⭐ Suggestion
📃 Motivating Example
💻 Use Cases
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Empieza leyendo los puntos de entrada del plugin del servicio de lenguaje nombrados en el issue, especialmente getEditsForRefactor y getCodeFixesAtPosition, junto con textChanges.ChangeTracker y sus métodos insertNodeAt, replaceNodeRange y delete. Determina la API pública y los requisitos de compatibilidad para exponer ChangeTracker, incluido cómo se usaría formatOptions; el trabajo está terminado cuando la superficie compatible y el enfoque de validación estén claros.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- typescript
- Área
- api, developer-experience
- 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
- 30/100