parseman 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1585,11 +1585,11 @@ var ParseDocImpl = class _ParseDocImpl {
1585
1585
  this.errors = errors;
1586
1586
  this.input = input;
1587
1587
  }
1588
- edit(changeStart, oldChangeEnd, newText) {
1589
- const newInput = this.input.slice(0, changeStart) + newText + this.input.slice(oldChangeEnd);
1588
+ edit(from, to, replacement) {
1589
+ const newInput = this.input.slice(0, from) + replacement + this.input.slice(to);
1590
1590
  if (!this.tree) return makeParseDoc(this._parser, this._ruleName, newInput);
1591
- const delta = newText.length - (oldChangeEnd - changeStart);
1592
- const found = findContaining(this.tree, changeStart);
1591
+ const delta = replacement.length - (to - from);
1592
+ const found = findContaining(this.tree, from);
1593
1593
  if (!found) return makeParseDoc(this._parser, this._ruleName, newInput);
1594
1594
  const ancestors = ancestorsAt(this.tree, found.path);
1595
1595
  const candidates = [found];