C# 클래스 Microsoft.R.Editor.Tree.EditorTree

Document tree for the editor. It does not derive from AST and rather aggregates it. The reason is that editor tree can be read and updated from different threads and hence we need to control access to the tree elements using appropriate locks. Typically there are three threads: main application thread which should be creating editor tree, incremental parse thread and validation (syntx check) thread.
상속: IEditorTree, IDisposable
파일 보기 프로젝트 열기: Microsoft/RTVS 1 사용 예제들

Private Properties

프로퍼티 타입 설명
ApplyChangesFromQueue List
Dispose void
FireOnNodesRemoved void
FireOnPositionsOnlyChanged void
FireOnUpdateBegin void
FireOnUpdateCompleted void
FireOnUpdatesPending void
FirePostUpdateEvents void
GetAstRootUnsafe Microsoft.R.Core.AST.AstRoot
InvalidateInRange bool
NotifyTextChange void
OnTextBufferChanged void
ProcessChanges void
TakeThreadOwnerShip void
ToString string

공개 메소드들

메소드 설명
AcquireReadLock ( System.Guid treeUserId ) : AstRoot
AcquireWriteLock ( ) : bool
Build ( ) : void

Builds initial AST. Subsequent updates should be coming from a background thread.

Dispose ( ) : void
EditorTree ( ITextBuffer textBuffer, ICoreShell shell, IExpressionTermFilter filter = null ) : System

Creates document tree on a given text buffer.

EnsureTreeReady ( ) : void

Ensures tree is up to date, matches current text buffer snapshot and all changes since the last update were processed. Blocks until all changes have been processed. Does not pump messages.

GetCommentBlockContainingRange ( ITextRange range ) : ITextRange

Determines if a given range is inside a comment and returns range of the comment block.

GetCommentBlockFromPosition ( int position ) : ITextRange

Determines if a given position is inside a comment and returns range of the comment block.

GetPositionElement ( int position, IAstNode &node ) : PositionType

Determines position type and enclosing element node for a given position in the document text.

Invalidate ( ) : void

Removes all elements from the tree

InvokeWhenReady ( Action action, object p, Type type, bool processNow = false ) : void

Provides a way to automatically invoke particular action once when tree becomes ready again. Typically used in asynchronous completion and signature help scenarios.

IsRangeInComment ( ITextRange range ) : bool

Determines if a given range is inside a comment.

IsRangeInComment ( int position ) : bool

Determines if a given position is inside a comment of any kind. Comment may be plain HTML comment or artifact type comment like <%--...--%> in ASP.NET or @* ... *@ in Razor.

ReleaseReadLock ( System.Guid treeUserId ) : bool
ReleaseWriteLock ( ) : bool

비공개 메소드들

메소드 설명
ApplyChangesFromQueue ( Queue queue ) : List
Dispose ( bool disposing ) : void
FireOnNodesRemoved ( IReadOnlyCollection nodes ) : void

Fires 'nodes removed' event on the main thread context

FireOnPositionsOnlyChanged ( ) : void

Fires 'positions changed starting inside this element' event on the main thread context

FireOnUpdateBegin ( ) : void

Fires 'update begin' event on the main thread context

FireOnUpdateCompleted ( TreeUpdateType updateType ) : void

Fires 'update end' event on the main thread context

FireOnUpdatesPending ( IReadOnlyCollection textChanges ) : void

Fires 'tree updates pending' event on the main thread context

FirePostUpdateEvents ( List changes, bool fullParse ) : void
GetAstRootUnsafe ( ) : AstRoot
InvalidateInRange ( ITextRange range ) : bool

Removes nodes from the tree collection if node range is partially or entirely within the deleted region. This is needed since parsing is asynchronous and without node removal intellisense and syntax checker may end up processing nodes that are out of date. Where possible stops at the nearest scope level so scope nodes may still be used in smart indenter.

NotifyTextChange ( int start, int oldLength, int newLength ) : void
OnTextBufferChanged ( object sender, TextContentChangedEventArgs e ) : void
ProcessChanges ( ) : void

Initiates processing of pending changes synchronously.

TakeThreadOwnerShip ( ) : void

Makes current thread owner of the tree. Normally only one thread can access the tree.

ToString ( ) : string

메소드 상세

AcquireReadLock() 공개 메소드

public AcquireReadLock ( System.Guid treeUserId ) : AstRoot
treeUserId System.Guid
리턴 Microsoft.R.Core.AST.AstRoot

AcquireWriteLock() 공개 메소드

public AcquireWriteLock ( ) : bool
리턴 bool

Build() 공개 메소드

Builds initial AST. Subsequent updates should be coming from a background thread.
public Build ( ) : void
리턴 void

Dispose() 공개 메소드

public Dispose ( ) : void
리턴 void

EditorTree() 공개 메소드

Creates document tree on a given text buffer.
public EditorTree ( ITextBuffer textBuffer, ICoreShell shell, IExpressionTermFilter filter = null ) : System
textBuffer ITextBuffer Text buffer
shell ICoreShell
filter IExpressionTermFilter
리턴 System

EnsureTreeReady() 공개 메소드

Ensures tree is up to date, matches current text buffer snapshot and all changes since the last update were processed. Blocks until all changes have been processed. Does not pump messages.
public EnsureTreeReady ( ) : void
리턴 void

GetCommentBlockContainingRange() 공개 메소드

Determines if a given range is inside a comment and returns range of the comment block.
public GetCommentBlockContainingRange ( ITextRange range ) : ITextRange
range ITextRange Text range to check
리턴 ITextRange

GetCommentBlockFromPosition() 공개 메소드

Determines if a given position is inside a comment and returns range of the comment block.
public GetCommentBlockFromPosition ( int position ) : ITextRange
position int Position to check
리턴 ITextRange

GetPositionElement() 공개 메소드

Determines position type and enclosing element node for a given position in the document text.
public GetPositionElement ( int position, IAstNode &node ) : PositionType
position int Position in the document text
node IAstNode Node that contains position
리턴 PositionType

Invalidate() 공개 메소드

Removes all elements from the tree
public Invalidate ( ) : void
리턴 void

InvokeWhenReady() 공개 메소드

Provides a way to automatically invoke particular action once when tree becomes ready again. Typically used in asynchronous completion and signature help scenarios.
public InvokeWhenReady ( Action action, object p, Type type, bool processNow = false ) : void
action Action Action to invoke
p object Parameter to pass to the action
type System.Type Action identifier
processNow bool /// If true, change processing begins now. /// If false, next regular parsing pass with process pending changes. ///
리턴 void

IsRangeInComment() 공개 메소드

Determines if a given range is inside a comment.
public IsRangeInComment ( ITextRange range ) : bool
range ITextRange Text range
리턴 bool

IsRangeInComment() 공개 메소드

Determines if a given position is inside a comment of any kind. Comment may be plain HTML comment or artifact type comment like <%--...--%> in ASP.NET or @* ... *@ in Razor.
public IsRangeInComment ( int position ) : bool
position int Position in the document
리턴 bool

ReleaseReadLock() 공개 메소드

public ReleaseReadLock ( System.Guid treeUserId ) : bool
treeUserId System.Guid
리턴 bool

ReleaseWriteLock() 공개 메소드

public ReleaseWriteLock ( ) : bool
리턴 bool