Expose `textChanges.ChangeTracker` for public API

Aberta
#53,399 1 comentário 1 reação 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
5/5
Tempo estimado
Mais de uma semana
Facilidade para iniciantes
30/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Estagnada
Stack de tecnologia
typescript

Direção de pesquisa

Comece lendo os pontos de entrada do plugin do serviço de linguagem mencionados na issue, especialmente getEditsForRefactor e getCodeFixesAtPosition, juntamente com textChanges.ChangeTracker e seus métodos insertNodeAt, replaceNodeRange e delete. Determine a API pública e os requisitos de compatibilidade para expor ChangeTracker, incluindo como formatOptions seria usado; o trabalho estará concluído quando a superfície compatível e a abordagem de validação estiverem claras.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

Awaiting More Feedback Suggestion

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

Linguagem predominante
Go
Estrelas
111k
Forks
14.4k
Merge médio
1d 19h
PRs com merge (30d)
117

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de microsoft/TypeScript

Todas as issues de microsoft/TypeScript

Issues semelhantes

Mais issues de Go

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.