NodeDomain lesson with Adobe Brackets
I've been an IntelliJ IDEA user for 4 years now but I usually have most features turned off but it's a memory hog, the constant indexing and overall sluggish performance has been annoying me for quite some time. I was turned onto Adobe Brackets a couple weeks ago by Seth Lemmons (fellow Senchan). Right out of the gate, I knew it wasn't going to be feature rich like IDEA which is good and bad. Overall, it does a pretty good job for me and after a couple existing extensions it's better. There are a couple feature gaps between the two and since Brackets is really just a web app I can build extensions using JavaScript (not Java or Ruby like other editors/IDEs) which is a nice appeal.
The first extension I'm building is Sencha Cmd integration. I normally have my editor and iTerm open at the same time. With iTerm I normally have a couple tabs open, one to start my node server and another to run builds with Cmd. So I wanted to be able to run a Cmd build within Brackets so that I don't have to switch back to iTerm to run a build.
Being my first extension, I had to look around at existing plugins that can execute commands such as hdy.brackets-shell extension. I learned that I have to create a NodeDomain spec to be able to use Node.js' child_process module. This made me learn a bit of how Brackets work. It turns out that Brackets has a Node.js server running behind the scenes which you can communicate with via NodeDomain which uses NodeConnection (you can also have NodeConnection create the NodeDomain so you can go at it either way). NodeConnection then uses websockets to communicate from the client web app that you interact with and the Node.js server. I got a basic setup working but I was beating my head against my desk wondering why when I make a change to my NodeDomain spec that I wasn't seeing it applied when I would reload Brackets with extensions (cmd + r keyboard shortcut on Mac). Turns out when you reload Brackets, you are only really reloading the client web app, not the Node.js server which needs to happen to make your NodeDomain spec changes take affect.
So the solution is to either quit Brackets and start it back up or you can restart Node via the Debug -> Restart Node menu item. I wish there was an option to reload Brackets and restart Node with a single menu item. Guess a new extension for this is on my list.