ReadonlylanguageThe document's language id, e.g. 'typescript'.
ReadonlylineNumber of lines in the document.
ReadonlyselectionsThe current selections, primary first.
The text of the line the cursor is on.
Replaces spans, as one undo step.
The whole batch is resolved against the document as it stands when the call
starts, so the ranges do not shift out from under each other.
Resolves false when the platform refuses the edit and rejects on an
adapter failure.
Optionaloptions: TextEditOptionsRuns stages in order, as a single undo step.
Each stage is handed the editor after the previous stage landed, which is the difference from ActiveEditor.edit: one batch resolves every replacement against the original document, so it cannot express "sort the lines, then dedupe what sorting produced".
Without this, a three-stage pipeline is either three undos or three edits
computed against a document that no longer looks like that.
Stops and resolves false at the first refused stage; a thrown/rejected
stage or adapter failure rejects.
Inserts text at the cursor.
A line's text, or '' when the line does not exist.
Where the document lives, or undefined for an untitled: document, which
has no path at all.
Resolves many positions to offsets in a single pass — the inverse of ActiveEditor.positionsAt. Out-of-range lines clamp; out-of-range characters do not, so pass positions already valid for the document.
Optionalsignal: AbortSignalResolves many offsets to positions in a single pass over the document, rather than one lookup each. Out-of-range offsets clamp to the document.
signal is checked between lookups so a large batch stops promptly.
Optionalsignal: AbortSignalBuilds a span from two document offsets — the shape a regex match gives you.
Every non-empty selection's text, in selection order.
Selects a whole line. Does nothing when the line does not exist.
The text between two document offsets.
Rewrites every non-empty selection as one undo step. False when nothing is selected.
Everything an extension does to the editor the user is looking at.
Obtained from EditorService.active, so the "is there an editor?" question is answered once, at the top of a handler, instead of by every function separately.