C# Class PowerStudio.LanguageServices.Tests.Mocks.TextBufferMock

Inheritance: ITextBuffer
Exibir arquivo Open project: IntelliTect/PowerStudio Class Usage Examples

Public Methods

Method Description
ChangeContentType ( IContentType newContentType, object editTag ) : void

Changes the T:Microsoft.VisualStudio.Utilities.IContentType for this T:Microsoft.VisualStudio.Text.ITextBuffer.

CheckEditAccess ( ) : bool

Determines whether edit operations on this text buffer are permitted on the calling thread. If M:Microsoft.VisualStudio.Text.ITextBuffer.TakeThreadOwnership has previously been called, edit operations are permitted only from the same thread that made that call.

CreateEdit ( ) : ITextEdit

Creates an T:Microsoft.VisualStudio.Text.ITextEdit object that handles compound edit operations on this buffer.

This method is equivalent to CreateEdit(EditOptions.None, null, null).

CreateEdit ( EditOptions options, int reiteratedVersionNumber, object editTag ) : ITextEdit

Creates an T:Microsoft.VisualStudio.Text.ITextEdit object that handles compound edit operations on this buffer.

CreateReadOnlyRegionEdit ( ) : IReadOnlyRegionEdit

Creates an T:Microsoft.VisualStudio.Text.IReadOnlyRegionEdit object that handles adding or removing read-only regions from this buffer.

Delete ( Span deleteSpan ) : ITextSnapshot

Deletes a sequence of characters from the buffer.

This is a shortcut for creating a new T:Microsoft.VisualStudio.Text.ITextEdit object, using it to delete the text, and then applying it. If the deletion fails on account of a read-only region, the snapshot returned will be the same as the current snapshot of the buffer before the attempted deletion.

GetReadOnlyExtents ( Span span ) : NormalizedSpanCollection

Gets a list of read-only regions that overlap the given span.

This method returns an empty list if there are no read-only regions intersecting the span, or if the span is zero-length.

Insert ( int position, string text ) : ITextSnapshot

Inserts the given textat the specified positionin the T:Microsoft.VisualStudio.Text.ITextBuffer.

This is a shortcut for creating a new T:Microsoft.VisualStudio.Text.ITextEdit object, using it to insert the text, and then applying it. If the insertion fails on account of a read-only region, the snapshot returned will be the same as the current snapshot of the buffer before the attempted insertion.

IsReadOnly ( Span span ) : bool

Determines whether a text modification or deletion would be prohibited at span due to an T:Microsoft.VisualStudio.Text.IReadOnlyRegion

IsReadOnly ( Span span, bool isEdit ) : bool

Determines whether a text modification or deletion would be prohibited at span due to an T:Microsoft.VisualStudio.Text.IReadOnlyRegion

IsReadOnly ( int position ) : bool

Determines whether a text insertion would be prohibited at position due to an T:Microsoft.VisualStudio.Text.IReadOnlyRegion.

IsReadOnly ( int position, bool isEdit ) : bool

Determines whether a text insertion would be prohibited at position due to an T:Microsoft.VisualStudio.Text.IReadOnlyRegion.

Replace ( Span replaceSpan, string replaceWith ) : ITextSnapshot

Replaces a sequence of characters with different text. This is equivalent to first deleting the text to be replaced and then inserting the new text.

This is a shortcut for creating a new T:Microsoft.VisualStudio.Text.ITextEdit object, using it to replace the text, and then applying it. If the replacement fails on account of a read-only region, the snapshot returned will be the same as the current snapshot of the buffer before the attempted replacement.

TakeThreadOwnership ( ) : void

Claims ownership of this buffer for the current thread. All subsequent modifications of this T:Microsoft.VisualStudio.Text.ITextBuffer must be made from the current thread, or else an T:System.InvalidOperationException will be raised.

TextBufferMock ( string content ) : System

Method Details

ChangeContentType() public method

Changes the T:Microsoft.VisualStudio.Utilities.IContentType for this T:Microsoft.VisualStudio.Text.ITextBuffer.
is null. Another object is active for this , or /// would return false.
public ChangeContentType ( IContentType newContentType, object editTag ) : void
newContentType IContentType The new .
editTag object An arbitrary object that will be associated with this edit transaction.
return void

CheckEditAccess() public method

Determines whether edit operations on this text buffer are permitted on the calling thread. If M:Microsoft.VisualStudio.Text.ITextBuffer.TakeThreadOwnership has previously been called, edit operations are permitted only from the same thread that made that call.
public CheckEditAccess ( ) : bool
return bool

CreateEdit() public method

Creates an T:Microsoft.VisualStudio.Text.ITextEdit object that handles compound edit operations on this buffer.
This method is equivalent to CreateEdit(EditOptions.None, null, null).
Another object is active for this text buffer.
public CreateEdit ( ) : ITextEdit
return ITextEdit

CreateEdit() public method

Creates an T:Microsoft.VisualStudio.Text.ITextEdit object that handles compound edit operations on this buffer.
Another object is active for this text buffer, or /// would return false.
public CreateEdit ( EditOptions options, int reiteratedVersionNumber, object editTag ) : ITextEdit
options EditOptions Options to apply to the compound edit operation.
reiteratedVersionNumber int If not null, indicates that the version to be created by this edit operation is /// the product of an undo or redo operation.
editTag object An arbitrary object that will be associated with this edit transaction.
return ITextEdit

CreateReadOnlyRegionEdit() public method

Creates an T:Microsoft.VisualStudio.Text.IReadOnlyRegionEdit object that handles adding or removing read-only regions from this buffer.
Another object is active for this text buffer, or /// would return false.
public CreateReadOnlyRegionEdit ( ) : IReadOnlyRegionEdit
return IReadOnlyRegionEdit

Delete() public method

Deletes a sequence of characters from the buffer.
This is a shortcut for creating a new T:Microsoft.VisualStudio.Text.ITextEdit object, using it to delete the text, and then applying it. If the deletion fails on account of a read-only region, the snapshot returned will be the same as the current snapshot of the buffer before the attempted deletion.
.End is greater than the length of the buffer. A TextEdit is currently active, or /// would return false.
public Delete ( Span deleteSpan ) : ITextSnapshot
deleteSpan Span The span of characters to delete.
return ITextSnapshot

GetReadOnlyExtents() public method

Gets a list of read-only regions that overlap the given span.
This method returns an empty list if there are no read-only regions intersecting the span, or if the span is zero-length.
is null. is past the end of the buffer. has previously been called, and this call is being made /// from a different thread.
public GetReadOnlyExtents ( Span span ) : NormalizedSpanCollection
span Span The span to check for read-only regions. ///
return NormalizedSpanCollection

Insert() public method

Inserts the given textat the specified positionin the T:Microsoft.VisualStudio.Text.ITextBuffer.
This is a shortcut for creating a new T:Microsoft.VisualStudio.Text.ITextEdit object, using it to insert the text, and then applying it. If the insertion fails on account of a read-only region, the snapshot returned will be the same as the current snapshot of the buffer before the attempted insertion.
is less than zero or greater than the length of the buffer. is null. A text edit is currently active, or /// would return false.
public Insert ( int position, string text ) : ITextSnapshot
position int The buffer position at which the first character of the text will appear.
text string The text to be inserted.
return ITextSnapshot

IsReadOnly() public method

Determines whether a text modification or deletion would be prohibited at span due to an T:Microsoft.VisualStudio.Text.IReadOnlyRegion
is null. The property of is greater than .Length. has previously been called, and this call is being made /// from a different thread.
public IsReadOnly ( Span span ) : bool
span Span The span to check.
return bool

IsReadOnly() public method

Determines whether a text modification or deletion would be prohibited at span due to an T:Microsoft.VisualStudio.Text.IReadOnlyRegion
is null. The property of is greater than .Length. has previously been called, and this call is being made /// from a different thread.
public IsReadOnly ( Span span, bool isEdit ) : bool
span Span The span to check.
isEdit bool true if this check is part of an edit. false for a querry without side effects.
return bool

IsReadOnly() public method

Determines whether a text insertion would be prohibited at position due to an T:Microsoft.VisualStudio.Text.IReadOnlyRegion.
is negative or greater than .Length. has previously been called, and this call is being made /// from a different thread.
public IsReadOnly ( int position ) : bool
position int The position of the proposed text insertion.
return bool

IsReadOnly() public method

Determines whether a text insertion would be prohibited at position due to an T:Microsoft.VisualStudio.Text.IReadOnlyRegion.
is negative or greater than .Length. has previously been called, and this call is being made /// from a different thread.
public IsReadOnly ( int position, bool isEdit ) : bool
position int The position of the proposed text insertion.
isEdit bool true if this check is part of an edit. false for a query without side effects.
return bool

Replace() public method

Replaces a sequence of characters with different text. This is equivalent to first deleting the text to be replaced and then inserting the new text.
This is a shortcut for creating a new T:Microsoft.VisualStudio.Text.ITextEdit object, using it to replace the text, and then applying it. If the replacement fails on account of a read-only region, the snapshot returned will be the same as the current snapshot of the buffer before the attempted replacement.
.End is greater than the length of the buffer. is null. A text edit is currently active, or /// would return false.
public Replace ( Span replaceSpan, string replaceWith ) : ITextSnapshot
replaceSpan Span The span of characters to replace.
replaceWith string The new text to replace the old.
return ITextSnapshot

TakeThreadOwnership() public method

Claims ownership of this buffer for the current thread. All subsequent modifications of this T:Microsoft.VisualStudio.Text.ITextBuffer must be made from the current thread, or else an T:System.InvalidOperationException will be raised.
This method has been called previously from a different thread, or a /// object is active for this text buffer.
public TakeThreadOwnership ( ) : void
return void

TextBufferMock() public method

public TextBufferMock ( string content ) : System
content string
return System