Skip to main content

Interface: TextEditorEdit

libs/common/types/TextEditorEdit.TextEditorEdit

A complex edit that will be applied in one transaction on a TextEditor. This holds a description of the edits and if the edits are valid (i.e. no overlapping regions, document was not changed in the meantime, etc.) they can be applied on a document associated with a text editor.

Methods

delete

delete(location): void

Delete a certain text region.

Parameters

NameTypeDescription
locationRangeThe range this operation should remove.

Returns

void

Defined in

libs/common/types/TextEditorEdit.ts:33


insert

insert(location, value): void

Insert text at a location. You can use \r\n or \n in value and they will be normalized to the current document. Although the equivalent text edit can be made with replace, insert will produce a different resulting selection (it will get moved).

Parameters

NameTypeDescription
locationPositionThe position where the new text should be inserted.
valuestringThe new text this operation should insert.

Returns

void

Defined in

libs/common/types/TextEditorEdit.ts:26


replace

replace(location, value): void

Replace a certain text region with a new value. You can use \r\n or \n in value and they will be normalized to the current document.

Parameters

NameTypeDescription
locationRange | PositionThe range this operation should remove.
valuestringThe new text this operation should insert after removing location.

Returns

void

Defined in

libs/common/types/TextEditorEdit.ts:16


setEndOfLine

setEndOfLine(endOfLine): void

Set the end of line sequence.

Parameters

NameTypeDescription
endOfLineEndOfLineThe new end of line for the document.

Returns

void

Defined in

libs/common/types/TextEditorEdit.ts:40