let's add the "preview" method that returns what to peak ahead and look at within error MESSAGES.
/**
* @typedef {object} Term
* ...
* @property {(text: string) => string} preview
*/
our string term only needs to peak ahead as far as the length of its string.
Term.string = (string) => ({
...Term.Default,
preview(text) {
return text.slice(0, string.length)
}
})
by default, we can just truncate by a SENSIBLE amount for now.
Term.Default = {
//...
preview(text) {
return text.slice(0, 10)
}
}
here it is in action.
back to the dream