Skip to content

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.

ParameterTypeDescription
textstringThe document the edits were computed against.
editsreadonly TextEdit[]The edits to apply.

string

The document with every edit applied.