This site describes solve-engine as it is on main: 2.43.0, which npm does not have yet. npm installs 2.40.0, so a page may show an answer that version does not give yet.
applyTextEdits
function applyTextEdits(text, edits): string;Defined in: packages/engine/src/language/DocumentReferences.ts:201
Apply edits to a document’s text and return the new text.
The edits are the ones this module returns: against text as it stood, not
overlapping. They are applied from the last to the first, so no edit moves
the text another one points at. An editor applies them as one change set
instead, which keeps them as one step in its undo history.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
text | string | The document the edits were computed against. |
edits | readonly TextEdit[] | The edits to apply. |
Returns
Section titled “Returns”string
The document with every edit applied.