2 hours later…
In this screenshot you can see some compiler statistics. (Yes, you can use the compiler service as a pretty-printer or minifier)
Dubious code is flagged with warnings. (I like the “Is there a bug?” message)
If you get the script plain wrong, you’ll be greeted with an error.
I love the fact that it is possible to whip up something like this in just a couple of hours.
The Visual Studio Integration was built as a CodeRush plugin (which takes a full 5 minutes). The rest of the time was spent reading the Closure web service spec and parsing the results from the web service.
It’s not all good however. In the current implementation you need to copy the source from the editor to the code pane in the tool window which isn’t a great user experience. Also, there’s no easy way to “jump” to the error location when there is a warning or an error. There is also no UI for setting the compiler options.
Future Plans: (Maybe)
- Compile the enclosing scope under the caret by pressing a key combination.
- Integrate with Visual Studio Error tool window. (I have no idea how to do that)
- Expose the compiler options through an option page. (Currently I use some decent defaults)
- Any other ideas?
If there’s interest, I’m considering writing up a small series of how the plugin was built including source and binaries. (It’s small enough that it won’t take all my spare time)