C# Class Microsoft.R.Editor.TextViewExtensions

Show file Open project: Microsoft/RTVS

Public Methods

Method Description
GetIdentifierUnderCaret ( this textView, Span &span ) : string

Extracts identifier sequence at the caret location. Fetches parts of 'abc$def' rather than tne entire expression. If there is selection, returns complete selected item as is.

GetItemAtPosition ( ITextSnapshotLine line, int position, bool>.Func tokenTypeCheck, Span &span ) : string
GetItemBeforeCaret ( this textView, Span &span, bool>.Func tokenTypeCheck = null ) : string

Extracts identifier or a keyword before caret. Typically used when inserting expansions (aka code snippets) at the caret location.

GetVariableNameBeforeCaret ( this textView ) : string

Extracts complete variable name under the caret. In '`abc`$`def` returns the complete expression rather than its parts. Typically used to get data for completion of variable members as in when user typed 'abc$def$' Since method does not perform semantic analysis, it does not guaratee syntactically correct expression, it may return 'a$$b'.

MapDownToR ( this textView, SnapshotSpan span ) : NormalizedSnapshotSpanCollection
MapDownToR ( this textView, SnapshotPoint position ) : SnapshotPoint?

Private Methods

Method Description
IsVariableNameToken ( string lineText, RToken token ) : bool

Method Details

GetIdentifierUnderCaret() public static method

Extracts identifier sequence at the caret location. Fetches parts of 'abc$def' rather than tne entire expression. If there is selection, returns complete selected item as is.
public static GetIdentifierUnderCaret ( this textView, Span &span ) : string
textView this
span Span
return string

GetItemAtPosition() public static method

public static GetItemAtPosition ( ITextSnapshotLine line, int position, bool>.Func tokenTypeCheck, Span &span ) : string
line ITextSnapshotLine
position int
tokenTypeCheck bool>.Func
span Span
return string

GetItemBeforeCaret() public static method

Extracts identifier or a keyword before caret. Typically used when inserting expansions (aka code snippets) at the caret location.
public static GetItemBeforeCaret ( this textView, Span &span, bool>.Func tokenTypeCheck = null ) : string
textView this
span Span
tokenTypeCheck bool>.Func
return string

GetVariableNameBeforeCaret() public static method

Extracts complete variable name under the caret. In '`abc`$`def` returns the complete expression rather than its parts. Typically used to get data for completion of variable members as in when user typed 'abc$def$' Since method does not perform semantic analysis, it does not guaratee syntactically correct expression, it may return 'a$$b'.
public static GetVariableNameBeforeCaret ( this textView ) : string
textView this
return string

MapDownToR() public static method

public static MapDownToR ( this textView, SnapshotSpan span ) : NormalizedSnapshotSpanCollection
textView this
span SnapshotSpan
return NormalizedSnapshotSpanCollection

MapDownToR() public static method

public static MapDownToR ( this textView, SnapshotPoint position ) : SnapshotPoint?
textView this
position SnapshotPoint
return SnapshotPoint?