cursorless-dev / cursorless

Don't let the cursor slow you down
https://www.cursorless.org/
MIT License
1.14k stars 79 forks source link

Add "mark" action to bookmark a target #46

Open pokey opened 3 years ago

pokey commented 3 years ago

The problem

Cursorless has no way to store a reference to a target for future use. The most obvious use case for this functionality is basic bookmarking, where a user can create a short name for a location in a document to jump back to later.

However, this basic functionality only scratches the surface of what can be done using an operation that creates a named reference to a cursorless target. There are two main aspects to cursorless that makes this type of bookmark far more powerful than what can be done using a simple bookmarking library.

A rich set of actions

The first component is that cursorless supports many different actions. The basic operation of jumping back to a bookmark as described at the top of this issue can be accomplished by issuing the "take" action on the book mark. Even this operation, though, is likely more powerful than with a traditional bookmarks library, because it can be used to restore an exact set of selections, and these selections will be updated even as the document evolves.

However, these bookmarks can also be referred to without ever jumping to them. For example, a user could book mark a location in a file and then browse around their project directory moving statements and functions into that file by using the bookmark as the destination of a "move" command.

Semantically rich targets

The second component that makes cursorless bookmarks powerful is the fact that a cursorless target can be much more than just a location in a document. Cursorless targets can contain rich contextual information such as how the target functions within the parse tree of the file to enable smart updating such as adding new items to a list. Cursorless targets could also be stitched together into cross file bookmarks to enable updating multiple files at the same time. Cursorless targets also needn't be restricted to locations in documents at all. See below for a bit more about this type of use case.

The solution

Fun stuff

In this section we discuss various advanced / experimental possible use cases for cursorless bookmarks. See What's next for more about this type of use case.

Non-positional targets

These bookmarks could actually be used to capture arbitrary targets, literal strings, snippets made on the fly from targets by specifying "holes", etc. This functionality enables much more complex chains because they can extend beyond a single voice command

These "bookmarks" could go into the user's bookmark library to be used again

Pipelines

Could capture recent sequence of commands, or sequence of commands leading to a bookmark, allowing user to turn that into a reusable pipeline that goes into the library as well. Should these pipelines just be a form of bookmark / target as well?

Smart marks

Could be defined via a regex rather than a range, to make them more robust. Would be useful for long-lived marks, marks that are persisted with the repo, and plop.js-like functionality

Social marks

Viewing marks

pokey commented 9 months ago

update from meet-up: