Implement Interface Sublime Text Plugin

While working in Visual Studio a while back, I noticed a cool little feature that allows you to import method stubs for an interface you are implementing. Since I’m madly in love with Sublime Text, I decided to try and write a plugin that does the same thing.

This was my first stab at a Sublime Text plugin (and my first real look into Python actually), but I think it went pretty well. I don’t spend an ungodly amount of time implementing interfaces, but it was fun putting this together and I think it’s pretty cool. Technically the plugin doesn’t care if the target is an interface. It will work on any class, but it’s meant for interfaces and even abstract classes (if you want to override a method).

Check out the GitHub gist if you want to give the plugin a try. To set it up, save the python files from the gist to your Packages folder. I have mine at C:\Users\USERNAME\AppData\Roaming\Sublime Text 3\Packages\Implementer. Then create a key binding to trigger the plugin. My key binding is below.

Now to trigger the plugin, click on the name of the interface you want to implement and press your key binding (mine is f1). The plugin will give you a list of methods to choose from, or you can implement all of the methods.

I am just using a regular expression to parse the target class. It works pretty well, and it pulls in any parameters and type declarations too. I even tested a few PHP 7 features. Here’s a regex101 test with some examples.

sublime text 3 implement interface plugin

Unity in Action

Over the past few weeks, I’ve been working my way through Unity in Action by Joe Hocking. The book does an amazing job of getting you up and running in Unity very quickly. I was excited to see that he even covers a bit about basic 3D modeling and UV mapping in Blender. I made a concrete bench. Woo! Really though, it’s so fun.

What’s mind blowing is how quickly the book gets you implementing components like first and third person cameras, HUDs, animations, physics, and even HTTP requests. And Unity makes this stuff dead simple. It really is unbelievable. Anyway, I highly recommend the book if you are looking to learn a bit about Unity and game development. Oh! And purchasing the physical book comes with free electronic versions including pdf and Kindle. Nice!