feat: add API for editing points and ranges

This commit is contained in:
Amaan Qureshi 2025-09-18 23:28:34 -04:00 committed by Amaan Qureshi
parent 1a0868c487
commit a69367f739
9 changed files with 209 additions and 39 deletions

View file

@ -708,6 +708,24 @@ void ts_node_edit(TSNode *self, const TSInputEdit *edit);
*/
bool ts_node_eq(TSNode self, TSNode other);
/**
* Edit a point to keep it in-sync with source code that has been edited.
*
* This function updates a single point's byte offset and row/column position
* based on an edit operation. This is useful for editing points without
* requiring a tree or node instance.
*/
void ts_point_edit(TSPoint *point, uint32_t *point_byte, const TSInputEdit *edit);
/**
* Edit a range to keep it in-sync with source code that has been edited.
*
* This function updates a range's start and end positions based on an edit
* operation. This is useful for editing ranges without requiring a tree
* or node instance.
*/
void ts_range_edit(TSRange *range, const TSInputEdit *edit);
/************************/
/* Section - TreeCursor */
/************************/