Having beautifiers format code on automated insert?


This Issue (and others like it) got me to thinking:

Could we build a system where the appropriate code beautifier could be called to format some code inserted by autocomplete-plus or snippets? (Or potentially any other package.) I think this would be a win-win.


A brilliant idea if ever I saw one, might require some refactoring of some of the projects to provide a common event to publish/emit on insert text into buffer.

I see autocomplete-plus emit’s a did-confirm event:

confirm: (match) =>
  @emitter.emit('did-confirm', match)

However I can’t see anything being emitted by Snippets, I can’t imagine it would be particuarly difficult to do though.