FlarkEditRecorder class final

Records the calls made to one editor so that a session can be replayed as a test. A host attaches one while dogfooding and copies repro when something goes wrong.

The recorder observes the editor's calls (FlarkEditor.onCall) and keeps where its window starts (source, selection, forced source mode) and each call since, as the FlarkEditorCall it was, with what it returned. Its two readers of a call are repro, which writes it as Dart, and replay, which makes it again. A call keeps the change it made to the source rather than a copy of the document, and past capacity calls the oldest is folded into the window's start, so memory stays near one document plus the recent changes. What the editor held before the window starts beyond that is not replayed: its history (an Undo past the window's start does nothing in the replay), a pending style and an unwritten table cell the caret was in. The repro says when the window starts with any of them.

Constructors

FlarkEditRecorder(FlarkEditor editor, {int capacity = 2000})
Records editor's calls from now on, as its FlarkEditor.onCall. An editor serves one observer at a time: one that has another throws a StateError.

Properties

capacity → int
The most calls kept.
final
editor → FlarkEditor
The editor recorded.
final
folded → int
Calls folded into the window's start because capacity was reached.
no setter
hashCode → int
The hash code for this object.
no setterinherited
length → int
The calls kept.
no setter
repro → String
Dart that rebuilds the editor where the window starts, makes the recorded calls with the times history used, and expects the source and selection they ended with. As a regression test it passes until the behavior changes: correct the expectations to the intended result.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

clear() → void
Forget the calls so far: the window starts again at the editor's present state.
detach() → void
Stop recording. The calls kept stay.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
replay(FlarkParseBackend backend, {CodeEditingDelegate? codeEditing}) → FlarkEditor
A fresh editor over backend with the recorded editor's limits, after the recorded calls. codeEditing stands in for the recorded editor's delegate, which a replay of code edits needs to behave the same.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

describeCommand(FlarkCommand command) → String
command as the Dart that constructs it.