Tim's blog

programming, crypto, etc in Waterloo, Ontario, Canada.

Introducing Substructed: a new way of editing code

October 03, 2013

I’d like to introduce you to a side project of mine. Substructed (demo) is a programming editor that takes advantage of the structured nature of code to allow advanced programmers to write and edit code more quickly.

Most editors today (such as Vim and Emacs) provide two dimensions for navigating code: down/up (rows) and left/right (columns). Substructed also provides two dimensions for navigation: forward/backward and in/out. Instead of navigating text, you navigate the syntax tree.

Consider, for example, the following JSON:

[
    "a",
    "b",
    "c",
    [
        "d",
        "e",
        "f"
    ],
    "g"
]

Substructed’s cursor looks essentially like a selection:

[
	"a",
	"b",
	"c",
	[
		"d",
		"e",
		"f"
	],
	"g"
]

If we navigate forward one movement (which corresponds to the “j” key in Substructed’s command mode), the cursor moves to the next element of the array:

[
    "a",
    "b",
    "c",
    [
        "d",
        "e",
        "f"
    ],
    "g"
]

If we navigate inward one movement (which corresponds to the enter key in Substructed’s command mode), the cursor moves inside the inner array to the first element:

[
    "a",
    "b",
    "c",
    [
        "d",
        "e",
        "f"
    ],
    "g"
]

Today, I’m open sourcing a prototype of Substructed (demo) that can edit JSON. Very soon, I would like to begin implementing support for “real” language (I’m currently considering Python). I’m making this prototype available now to collect feedback before moving forward.