parseman 0.1.0 → 0.1.2
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/README.md +14 -14
- package/dist/cst/incremental.d.ts +12 -8
- package/dist/cst/incremental.d.ts.map +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +4 -4
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
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(
|
|
1589
|
-
const newInput = this.input.slice(0,
|
|
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 =
|
|
1592
|
-
const found = findContaining(this.tree,
|
|
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];
|