dotject Atom Text Editor Plugin


After yesterday’s post about dotject, it quickly became apparent that although some people may find it useful, they wanted the dotject functionality to be part of an IDE. This was always my intention and it’s now available as an Atom plugin.


Titled as “a hackable text editor for the 21st Century”, GitHub’s Atom has created some controversy about being a closed-source open-source text editor (yes you read that right). Although the core isn’t open source, developers have the ability to develop plugins and themes to completely change or enhance the way the editor works.

The Plugin

I found it easy to create an Atom plugin for dotject, mainly due to it’s familiarity with npm (it also has a root package.json file etc). Under the hood, it even uses my dotject node package, so there’s no duplication of the dotject code whatsoever.


Use the Atom package manager, which can be found in the Settings view or run apm install dotject from the command line.


The default keymapping is shift-cmd-J (although this can be configured). You simply highlight your dotject string and press shift-cmd-J to perform the conversion.


Highlighting a.b.c,d.e then pressing shift-cmd-J will replace a.b.c,d.e with:


The code

It’s essentially 2 lines of code, with a little glue and keymapping:

// convert the current text selection
var converted = dotject(editor.getSelection().getText());
// insert the stringified json in place of the selection

This would all be perfect, if it was not for CoffeeScript (I’ve written in JavaScript above).