mscolnick / export-typescript

VSCode extension to export all modules in a directory and subdirectories via an `index.ts` file.
https://marketplace.visualstudio.com/items?itemName=mscolnick.export-typescript
MIT License
10 stars 3 forks source link

Option to format code after generation #18

Open IgnusG opened 2 years ago

IgnusG commented 2 years ago

Is your feature request related to a problem? Please describe. An option to format code after index.ts is written by the default formatter. If it's prettier it might change how the lines are indented. If it's something more complex it might sort exports etc.

Describe the solution you'd like A config option that when enabled runs the default formatter right after generating index.ts

Describe alternatives you've considered It might be a good idea to have this turned on by default by it might require a breaking change update. A config option, even if off by default, would be great though.

Additional context I see that export-typescript already applies some style by multi-lining exports when there are more than one. Some code-base styles would still inline these instead. Instead of taking sides or adding options to change how the code is generated, running the default formatter would fix most styling issues automatically and could be adjusted independently of this extension.

Great extension btw. I really like index.ts files to simplify imports and have been searching for a simple way to generate them automatically for a while now ❤️

IgnusG commented 2 years ago

Might be an improvement on (continuation of) https://github.com/mscolnick/export-typescript/issues/8

mscolnick commented 2 years ago

I've found it to be sufficient to enable format on save and that just runs prettier or your-favorite-formatter right after code generation. happy to take contributions to this one though