In my old IDE, I was able to:
1. Run an external perl script, which would read the selected text in the current document form stdin.
2. The perl script would transform the text and print the result to stdout.
3. The editor would replace the selected text with the transformed version, as output by the script.
The only way I've been able to find so far to come anywhere close to this in PHPStorm is to use an External Tool. Unless I'm missing something, this has two major drawbacks, though:
- The selected text is passed to the script on the commandline, not in stdin. When the selected text is large or complex, the shell will hit its limit or misinterpret the unusual characters in the text.
- There is no way to achieve #3 directly. Instead, the script has to actually modify the original file, which is very inefficient, IMHO. It also means one loses the ability to Undo the change.
Is there another way to do what I'm after? Or should I file a feature request?