You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Having added support for a few beautifiers now, it would be useful to have some library code to automate adding "easy" external formatters. They have the following properties:
Called on the command line as some-beautifier [arg ...].
The args (if any) in that command line are constant.
The beautifier writes all errors and warnings to stderr.
The beautifier exits zero on success, nonzero on error.
Code is read from stdin.
On success, the beautified code is written to stdout. Else nothing is written to stdout.
I copy-pasted this snippet to index.ts in all beautifier plugins I made:
In the format-all Emacs package I eventually made it have two APIs to call external formatters: an easy one and a hard one. The hard one is the same as the easy one but has some extra kludges for formatters that don't make proper use of their exit code.
The text was updated successfully, but these errors were encountered:
It's worth noting that the easy beautifiers will eventually have to take some beautifier options from .unibeautifyrc so that has to be taken into account.
I think this would have to go with https://github.com/Unibeautify/create-unibeautify-beautifier. Right now, all the create-unibeautify-beautifier does is copies from the template and replaces everything in handlebars via egad. For this case, I'd want the create-unibeautify-beautifier to conditionally add/remove contents based on the options users select in the cli when scaffolding.
It might be a good idea to subclass Beautifier into EasyExecutableBeautifier. This way boilerplate code is reduced, and all beautifiers can benefit from fixes to the base class. (Is "subclass" and "base class" the correct terminology in TypeScript?)
Having added support for a few beautifiers now, it would be useful to have some library code to automate adding "easy" external formatters. They have the following properties:
some-beautifier [arg ...]
.I copy-pasted this snippet to
index.ts
in all beautifier plugins I made:In the format-all Emacs package I eventually made it have two APIs to call external formatters: an
easy
one and ahard
one. The hard one is the same as the easy one but has some extra kludges for formatters that don't make proper use of their exit code.The text was updated successfully, but these errors were encountered: