@willbooster/web-tree-sitter 19.1.0 → 20.0.0

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.
@@ -48,47 +48,6 @@
48
48
  /** The memory imported by `web-tree-sitter.wasm`. */
49
49
  wasmMemory?: WebAssembly.Memory;
50
50
  }
51
- export class Edit {
52
- /** The start position of the change. */
53
- startPosition: Point;
54
- /** The end position of the change before the edit. */
55
- oldEndPosition: Point;
56
- /** The end position of the change after the edit. */
57
- newEndPosition: Point;
58
- /** The start index of the change. */
59
- startIndex: number;
60
- /** The end index of the change before the edit. */
61
- oldEndIndex: number;
62
- /** The end index of the change after the edit. */
63
- newEndIndex: number;
64
- constructor({ startIndex, oldEndIndex, newEndIndex, startPosition, oldEndPosition, newEndPosition, }: {
65
- startIndex: number;
66
- oldEndIndex: number;
67
- newEndIndex: number;
68
- startPosition: Point;
69
- oldEndPosition: Point;
70
- newEndPosition: Point;
71
- });
72
- /**
73
- * Edit a point and index to keep it in-sync with source code that has been edited.
74
- *
75
- * This function updates a single point's byte offset and row/column position
76
- * based on an edit operation. This is useful for editing points without
77
- * requiring a tree or node instance.
78
- */
79
- editPoint(point: Point, index: number): {
80
- point: Point;
81
- index: number;
82
- };
83
- /**
84
- * Edit a range to keep it in-sync with source code that has been edited.
85
- *
86
- * This function updates a range's start and end positions based on an edit
87
- * operation. This is useful for editing ranges without requiring a tree
88
- * or node instance.
89
- */
90
- editRange(range: Range): Range;
91
- }
92
51
  /**
93
52
  * Options for parsing
94
53
  *
@@ -203,10 +162,6 @@
203
162
  *
204
163
  * @param callback - The UTF8-encoded text to parse or a callback function.
205
164
  *
206
- * @param oldTree - A previous syntax tree parsed from the same document. If the text of the
207
- * document has changed since `oldTree` was created, then you must edit `oldTree` to match
208
- * the new text using {@link Tree#edit}.
209
- *
210
165
  * @param options - Options for parsing the text.
211
166
  * This can be used to set the included ranges, or a progress callback.
212
167
  *
@@ -215,7 +170,7 @@
215
170
  * - The progress callback returned true.
216
171
  * - The memory limit was reached or the operation limit was exceeded.
217
172
  */
218
- parse(callback: string | ParseCallback, oldTree?: Tree | null, options?: ParseOptions): Tree | null;
173
+ parse(callback: string | ParseCallback, options?: ParseOptions): Tree | null;
219
174
  /**
220
175
  * Instruct the parser to start the next parse from the beginning.
221
176
  *
@@ -364,28 +319,8 @@
364
319
  * forward by the given offset.
365
320
  */
366
321
  rootNodeWithOffset(offsetBytes: number, offsetExtent: Point): Node;
367
- /**
368
- * Edit the syntax tree to keep it in sync with source code that has been
369
- * edited.
370
- *
371
- * You must describe the edit both in terms of byte offsets and in terms of
372
- * row/column coordinates.
373
- */
374
- edit(edit: Edit): void;
375
322
  /** Create a new {@link TreeCursor} starting from the root of the tree. */
376
323
  walk(): TreeCursor;
377
- /**
378
- * Compare this old edited syntax tree to a new syntax tree representing
379
- * the same document, returning a sequence of ranges whose syntactic
380
- * structure has changed.
381
- *
382
- * For this to work correctly, this syntax tree must have been edited such
383
- * that its ranges match up to the new tree. Generally, you'll want to
384
- * call this method right after calling one of the [`Parser::parse`]
385
- * functions. Call it on the old tree that was passed to parse, and
386
- * pass the new tree that was returned from `parse`.
387
- */
388
- getChangedRanges(other: Tree): Range[];
389
324
  /** Get the included ranges that were used to parse the syntax tree. */
390
325
  getIncludedRanges(): Range[];
391
326
  }
@@ -394,14 +329,7 @@
394
329
  /**
395
330
  * The numeric id for this node that is unique.
396
331
  *
397
- * Within a given syntax tree, no two nodes have the same id. However:
398
- *
399
- * * If a new tree is created based on an older tree, and a node from the old tree is reused in
400
- * the process, then that node will have the same id in both trees.
401
- *
402
- * * A node not marked as having changes does not guarantee it was reused.
403
- *
404
- * * If a node is marked as having changed in the old tree, it will not be reused.
332
+ * Within a given syntax tree, no two nodes have the same id.
405
333
  */
406
334
  id: number;
407
335
  /** The byte index where this node starts. */
@@ -452,8 +380,6 @@
452
380
  * certain kinds of syntax errors.
453
381
  */
454
382
  get isMissing(): boolean;
455
- /** Check if this node has been edited. */
456
- get hasChanges(): boolean;
457
383
  /**
458
384
  * Check if this node represents a syntax error or contains any syntax
459
385
  * errors anywhere within it.
@@ -611,16 +537,6 @@
611
537
  * and the cursor cannot walk outside this node.
612
538
  */
613
539
  walk(): TreeCursor;
614
- /**
615
- * Edit this node to keep it in-sync with source code that has been edited.
616
- *
617
- * This function is only rarely needed. When you edit a syntax tree with
618
- * the {@link Tree#edit} method, all of the nodes that you retrieve from
619
- * the tree afterward will already reflect the edit. You only need to
620
- * use {@link Node#edit} when you have a specific {@link Node} instance that
621
- * you want to keep and continue to use after an edit.
622
- */
623
- edit(edit: Edit): void;
624
540
  /** Get the S-expression representation of this node. */
625
541
  toString(): string;
626
542
  }
@@ -8,7 +8,6 @@
8
8
  "ProgressCallback",
9
9
  "LogCallback",
10
10
  "ParserInitOptions",
11
- "Edit",
12
11
  "ParseOptions",
13
12
  "ParseState",
14
13
  "LANGUAGE_VERSION",
@@ -24,7 +23,6 @@
24
23
  "sources": [
25
24
  "src/constants.ts",
26
25
  "src/bindings.ts",
27
- "src/edit.ts",
28
26
  "src/parser.ts",
29
27
  "src/language.ts",
30
28
  "src/tree.ts",
@@ -40,9 +38,8 @@
40
38
  null,
41
39
  null,
42
40
  null,
43
- null,
44
41
  null
45
42
  ],
46
- "mappings": ";;;;;;kBASiBA,KAAKA;;;;;;;;;;kBAYLC,KAAKA;;;;;;;;;;;;;aAgCVC,aAAaA;;;;aAMbC,gBAAgBA;;;;;;aAOhBC,WAAWA;;kBC3DNC,iBAAiBA;;;;;;;;;cCLrBC,IAAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBCkBAC,YAAYA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAiDZC,UAAUA;;;;;;;;;;;;;;YAuBhBC,gBAAgBA;;;;;;YAOhBC,sBAAsBA;;;;;cAqCpBC,MAAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCqBRC,IAAIA;;;;;;;;;;;;;;;;;;;;cC/BJC,IAAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCGJC,UAAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCJVC,iBAAiBA",
47
44
  "ignoreList": []
48
45
  }
@@ -48,47 +48,6 @@
48
48
  /** The memory imported by `web-tree-sitter.wasm`. */
49
49
  wasmMemory?: WebAssembly.Memory;
50
50
  }
51
- export class Edit {
52
- /** The start position of the change. */
53
- startPosition: Point;
54
- /** The end position of the change before the edit. */
55
- oldEndPosition: Point;
56
- /** The end position of the change after the edit. */
57
- newEndPosition: Point;
58
- /** The start index of the change. */
59
- startIndex: number;
60
- /** The end index of the change before the edit. */
61
- oldEndIndex: number;
62
- /** The end index of the change after the edit. */
63
- newEndIndex: number;
64
- constructor({ startIndex, oldEndIndex, newEndIndex, startPosition, oldEndPosition, newEndPosition, }: {
65
- startIndex: number;
66
- oldEndIndex: number;
67
- newEndIndex: number;
68
- startPosition: Point;
69
- oldEndPosition: Point;
70
- newEndPosition: Point;
71
- });
72
- /**
73
- * Edit a point and index to keep it in-sync with source code that has been edited.
74
- *
75
- * This function updates a single point's byte offset and row/column position
76
- * based on an edit operation. This is useful for editing points without
77
- * requiring a tree or node instance.
78
- */
79
- editPoint(point: Point, index: number): {
80
- point: Point;
81
- index: number;
82
- };
83
- /**
84
- * Edit a range to keep it in-sync with source code that has been edited.
85
- *
86
- * This function updates a range's start and end positions based on an edit
87
- * operation. This is useful for editing ranges without requiring a tree
88
- * or node instance.
89
- */
90
- editRange(range: Range): Range;
91
- }
92
51
  /**
93
52
  * Options for parsing
94
53
  *
@@ -203,10 +162,6 @@
203
162
  *
204
163
  * @param callback - The UTF8-encoded text to parse or a callback function.
205
164
  *
206
- * @param oldTree - A previous syntax tree parsed from the same document. If the text of the
207
- * document has changed since `oldTree` was created, then you must edit `oldTree` to match
208
- * the new text using {@link Tree#edit}.
209
- *
210
165
  * @param options - Options for parsing the text.
211
166
  * This can be used to set the included ranges, or a progress callback.
212
167
  *
@@ -215,7 +170,7 @@
215
170
  * - The progress callback returned true.
216
171
  * - The memory limit was reached or the operation limit was exceeded.
217
172
  */
218
- parse(callback: string | ParseCallback, oldTree?: Tree | null, options?: ParseOptions): Tree | null;
173
+ parse(callback: string | ParseCallback, options?: ParseOptions): Tree | null;
219
174
  /**
220
175
  * Instruct the parser to start the next parse from the beginning.
221
176
  *
@@ -364,28 +319,8 @@
364
319
  * forward by the given offset.
365
320
  */
366
321
  rootNodeWithOffset(offsetBytes: number, offsetExtent: Point): Node;
367
- /**
368
- * Edit the syntax tree to keep it in sync with source code that has been
369
- * edited.
370
- *
371
- * You must describe the edit both in terms of byte offsets and in terms of
372
- * row/column coordinates.
373
- */
374
- edit(edit: Edit): void;
375
322
  /** Create a new {@link TreeCursor} starting from the root of the tree. */
376
323
  walk(): TreeCursor;
377
- /**
378
- * Compare this old edited syntax tree to a new syntax tree representing
379
- * the same document, returning a sequence of ranges whose syntactic
380
- * structure has changed.
381
- *
382
- * For this to work correctly, this syntax tree must have been edited such
383
- * that its ranges match up to the new tree. Generally, you'll want to
384
- * call this method right after calling one of the [`Parser::parse`]
385
- * functions. Call it on the old tree that was passed to parse, and
386
- * pass the new tree that was returned from `parse`.
387
- */
388
- getChangedRanges(other: Tree): Range[];
389
324
  /** Get the included ranges that were used to parse the syntax tree. */
390
325
  getIncludedRanges(): Range[];
391
326
  }
@@ -394,14 +329,7 @@
394
329
  /**
395
330
  * The numeric id for this node that is unique.
396
331
  *
397
- * Within a given syntax tree, no two nodes have the same id. However:
398
- *
399
- * * If a new tree is created based on an older tree, and a node from the old tree is reused in
400
- * the process, then that node will have the same id in both trees.
401
- *
402
- * * A node not marked as having changes does not guarantee it was reused.
403
- *
404
- * * If a node is marked as having changed in the old tree, it will not be reused.
332
+ * Within a given syntax tree, no two nodes have the same id.
405
333
  */
406
334
  id: number;
407
335
  /** The byte index where this node starts. */
@@ -452,8 +380,6 @@
452
380
  * certain kinds of syntax errors.
453
381
  */
454
382
  get isMissing(): boolean;
455
- /** Check if this node has been edited. */
456
- get hasChanges(): boolean;
457
383
  /**
458
384
  * Check if this node represents a syntax error or contains any syntax
459
385
  * errors anywhere within it.
@@ -611,16 +537,6 @@
611
537
  * and the cursor cannot walk outside this node.
612
538
  */
613
539
  walk(): TreeCursor;
614
- /**
615
- * Edit this node to keep it in-sync with source code that has been edited.
616
- *
617
- * This function is only rarely needed. When you edit a syntax tree with
618
- * the {@link Tree#edit} method, all of the nodes that you retrieve from
619
- * the tree afterward will already reflect the edit. You only need to
620
- * use {@link Node#edit} when you have a specific {@link Node} instance that
621
- * you want to keep and continue to use after an edit.
622
- */
623
- edit(edit: Edit): void;
624
540
  /** Get the S-expression representation of this node. */
625
541
  toString(): string;
626
542
  }
@@ -8,7 +8,6 @@
8
8
  "ProgressCallback",
9
9
  "LogCallback",
10
10
  "ParserInitOptions",
11
- "Edit",
12
11
  "ParseOptions",
13
12
  "ParseState",
14
13
  "LANGUAGE_VERSION",
@@ -24,7 +23,6 @@
24
23
  "sources": [
25
24
  "src/constants.ts",
26
25
  "src/bindings.ts",
27
- "src/edit.ts",
28
26
  "src/parser.ts",
29
27
  "src/language.ts",
30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