Executing a T4 text template in Visual Studio Code

This solution is not exactly what you asked, but it may be useful in many scenarios (on Windows OS only).

You can create a task in Visual Studio Code and run C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\TextTransform.exe. If you don't have Visual Studio you can copy this file to your project folder and execute it from that location.

Any extension that can run a .exe file can do the job.