Table of Contents

Class TextEditExtensions

Namespace
RDCore.SDK.Server.ProtocolExtensions
Assembly
RDCore.SDK.dll

The TextEdits of a document, made on its text as a client makes them (LSP 3.17 §TextEdit): what a fix, a refactoring or a formatting makes of the text, without a client.

public static class TextEditExtensions
Inheritance
TextEditExtensions
Inherited Members

Methods

ApplyTo(IEnumerable<TextEdit>, string)

The text, with the edits made. Every edit is placed by the text as it was before any of them (LSP 3.17 §TextEdit), so the order of the edits matters only for edits that insert at the same position.

public static string ApplyTo(this IEnumerable<TextEdit> edits, string text)

Parameters

edits IEnumerable<TextEdit>

The edits, none of them overlapping another. Edits that insert at the same position are written in the order they are given.

text string

The text the edits are of.

Returns

string

The edited text; text itself when there are no edits.

Remarks

A line ends at a \r\n, a \n or a \r (LSP 3.17 §Position). A character offset counts UTF-16 code units, the default position encoding of the protocol. A position past the end of its line is the end of the line, before its line end; a line past the last one is the end of the text.

Exceptions

ArgumentNullException

edits or text is null.

ArgumentException

Two edits overlap, or an edit ends before it starts.