I want to be able to select a block of code within IntelliJ and run an in-place transform on it (think source pre-processing, like CoffeeScript). Ideally, a keyboard shortcut would run a CLI script taking the selected text on stdin and returning the transformed text on stdout. IntelliJ would need to run the script and replace the selected text with the script's output.
Is there a generic plugin for IntelliJ that could do this, or would it be trivial to roll something like this myself? Any plugin that does something similar?
Sublime text does similar things via scripting and it allows some very cool custom behavior.