Feaure request: Ability to defer manipulations and generate TextChange[] or FileTextChanges[]
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 238
- Avg merge
- 2m
- Merged PRs (30d)
- 1
Description
**Is your feature request related to a problem? Please describe.**
I'm writing a script that automatically add JSDoc for more than 1k enum members in a single file.
It takes more than 15 seconds to `addJSDoc` for every enum members. And editing the structure cannot preserve the indentation.
**Describe the solution you'd like**
Add a method such as:
```typescript
const textChanges = sourceFile.defered(() => {
for (const enumMember of enumNode.getMembers()) {
enumMember.addJsDoc('balabala');
}
});
sourceFile.applyTextChanges(textChanges);
```
**Describe alternatives you've considered**
Manually generate TextChange objects, and then apply them, which will only cost about 300ms, much less than 15000ms+!
Contributor guide
Assessment
This issue has not been assessed yet.