Skip to content
Pokey Rule edited this page Jan 14, 2022 · 37 revisions

The big picture

Cursorless's major direction can be summed up as follows:

Cursorless will become a spoken programming language enabling large-scale, structurally aware voice-controlled code generation and refactoring.

This direction will enable levels of efficiency that aren't possible using today's keyboard-driven interfaces. Let's break down each component of the above statement.

"spoken programming language"

There's two aspects here: one is "programming language", and the second is "spoken ... language". Let's take each in turn

"programming language"

Today's cursorless grammar will become a full-fledged programming language inspired by jq. In the same way that jq enables powerful one-liners, which can easily grow into longer programs, we'd like cursorless commands to function like powerful "spoken one-liners", but also be chained into larger scale "spoken programs" that can transform your code in semantically rich ways by leveraging cursorless's deep integration with tree-sitter and vscode.

Today, cursorless targets are flat, enabling only a single modifier to be applied to a given mark, eg "funk air". We intend to make cursorless modifiers fully compositional, so that they can be joined into long chains. Examples include:

  • "first line [in] every funk"
  • "every string [in] block"
  • "first past fourth char [of] funk name"
  • "bring every reference to air as list" (for creating a mark down list of every reference to a particular symbol)

In addition to these inline chained targets, the targets can be stored in an intermediate form to enable even longer chains than can be uttered in a single command, either by using an enhanced that mark for impromptu chains, or by bookmarking intermediate steps of a chain, or even by bookmarking the chain itself as a reusable pipeline component.

See the tracker project for more info.

"spoken ... language"

Because cursorless is spoken, there is the opportunity for users to speak in long continuous sentences, rather than short, choppy commands. Although it is possible to issue fairly long phrases today, there are still limitations due to the way that cursorless handles its targets today. A great example of this limitation is described in #414. The best way to understand the type of limitations that exist today and how we plan to address them is to take a look at the tracker project.

Beyond just removing technical limitations, an important aspect of attaining fluency is education. The learning curve for cursorless can be quite daunting, so we have several efforts underway to enable new users to get up to speed much faster, and existing users to rapidly improve fluency. In particular, the cursorless tutorial will give users hands-on experience editing real code and text using cursorless, and our regular videos will also help users see cursorless in action and understand new features and concepts.

"large-scale, structurally aware"

There are two primary ways in which cursorless will be able to perform large-scale transformations.

Enhanced multiple cursor operation

One of the great ironies with cursorless is that it is most powerful when used with multiple cursors. Using multiple cursors without cursorless can be like herding cats. The problem is that the operations supported by your editor are often too low level to work correctly at each cursor. For example let's say I have three strings on my clipboard, and I want them to replace each of the following strings:

a = "hello world";
b = "high";
c = "I am a big old string";

Assuming I have a cursor in each string, with cursorless I can just say "paste to string".

We'd like to expand this power further by introducing new scope types and actions, as well as expanding support for operations that are specifically targeted at multiple cursor manipulation.

Check out the tracker project for more details

Operating on multiple files simultaneously

We'd also like to extend the powers of cursorless beyond operations within a single file. One of our inspirations for this type of operation is Plop, a "micro-generator framework" that allows parametrized operations across multiple files. The bookmarks described above could be stitched together into a combined bookmark that spans multiple files. Each component of the combined bookmark can indicate how new items are inserted using a stable snippet with smart holes.

For example, notice how much boilerplate is needed to add a cursorless hat color. By getting users comfortable with applying syntactic transformations and constructing lightweight snippets as part as their daily workflows, building large-scale, semantically rich transformations will become second nature, rather than a chore.

See the tracker project for more about this and other new modes of interaction we have planned for cursorless.

What else are we working on?

In addition to the big picture efforts above, we have several other projects under way to continue to improve cursorless.

Today, cursorless is restricted to editing text in VSCode. We'd like to expand the places where the cursorless grammar can be used, both within VSCode and without.

The cursorless code base is quite stable, due to its extensive suite of >1000 tests. However, it is still a bit rough around the edges in a few places. We'd like to remove the surprises, and get Cursorless to the point where it always does exactly what you'd expect, and you never have to clean up after it (which is rare, but still happens here and there 😊).

We'd like to make it easy for anyone to roll up their sleeves and hack on cursorless. The cursorless code base is strongly typed, modular, and fairly well documented, but can still be a bit daunting for new contributors. We'd like to create a proper documentation hub, including an internal API reference, videos, architecture overviews, etc.

Clone this wiki locally