Improve formatting

This commit is contained in:
Andras Schmelczer 2025-10-27 06:59:08 +00:00
parent 1b46e5d237
commit a1a339b23d
2 changed files with 19 additions and 3 deletions

View file

@ -180,6 +180,20 @@ export function reconcile(
return jsResult;
}
/**
* Generates a compact diff representation between an original and changed text.
*
* These can be parsed and unpacked using Rust crate's EditedText::from_change_set.
*
* This function computes the differences between two versions of text and returns
* a compact string representation of those changes. The returned format is
* serialised JSON.
*
* @param original - The original/base version of the text
* @param changed - The modified version of the text (either string or TextWithCursors with cursor positions)
* @param tokenizer - The tokenisation strategy, which is the same as used in `reconcile`.
* @returns A compact string representation of the diff between original and changed text
*/
export function getCompactDiff(
original: string,
changed: string | TextWithOptionalCursors,