I'd like to write an IntelliJ plugin that facilitates continuous testing. Not so much for serious development, yet, as much as to make it fun to practice coders dojo katas (http://content.codersdojo.org/home/).
As things stand, Infinitest will automatically run tests as soon as you make your project (for instance with Ctrl+F9).
I'd like to find a way to avoid having to do anything other than actually writing your code.
My first idea was to attach a listen to document save events, since I knew that IDEA automatically saves your files. Unfortunately this was not a good option as it is only invoked rarely, and usually due to user action.
My second idea was to spawn a thread that would sit there regularly attempting to run 'make' on the project - for instance every 5 seconds.
This got me much closer to my goal, but raised some issues.
- IDEA doesn't like unauthorised threads accessing the CompilerManager and calling .make()
- When there are issues with the .make() call, a panel is liable to pop up and steal focus from the editor
- If the .make() fails due to syntax errors which can be seen from IDEAs usual inspections, it would be better not to report or to have tried the .make()
Can anyone offer any advice as to either a better approach, or solutions to these problems?
Thanks very much!