Skip to content

ChangeAnswer

type ChangeAnswer =
| Simple
| {
replace: {
followUps?: readonly Intent[];
selection?: Range;
text: string;
};
};

What a shouldChangeText hook returns: allow() to accept the modification, veto(code, message) to refuse it, or replace(text, selection?) to put another text in its place. A replacement can also carry followUps, which are intents that run after the text is saved, in the same undo step, for what the text means beyond its words, such as a tag or a priority.