Skip to content

Track cursor positions #7

@mhuebert

Description

@mhuebert

In addition to being 'whitespace-aware', a magic-tree AST should be 'cursor-aware' and 'selection-aware'. This would allow us to implement editing commands purely in terms of the AST, instead of having to interop with host environment/editor. This will make testing straightforward, and allow for more freedoms in the visual representation and manipulation of code. (CodeMirror can be just one of many possible 'views' on an AST, one which happens to use a string representation.)

Involves:

  • A way to represent cursors/selections in the AST
  • Cursors/selections should 'flow' along with edits made to the AST. After updates are made, we must be able to get the updated cursors/selections (with accurate positions)
  • A way to sync cursors/selections with a host environment/editor (ie. update the cursors/selections of an AST in response to user interactions in an editor like CodeMirror, and vice versa)
  • Errors can be handled/reported differently depending on whether they stem from a node being currently edited or not.

(the above items are purely speculative and subject to change, lots of cross-cutting concerns here)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions