C# Class Microsoft.Sarif.Viewer.ResultTextMarker

This class represents an instance of "highlighed" line in the editor, holds necessary Shell objects and logic to managed lifecycle and appearance.
Mostrar archivo Open project: Microsoft/sarif-sdk Class Usage Examples

Public Methods

Method Description
AddHighlightMarker ( string highlightColor ) : void

Select current tracking text with highlightColor. If highlightColor is null than code will be selected with color from Color. If the mark doesn't support tracking changes, then we simply ignore this condition (addresses VS crash reported in Bug 476347 : Code Analysis clicking error report C6244 causes VS2012 to crash). Tracking changes helps to ensure that we nativate to the right line even if edits to the file have occured, but even if that behavior doesn't work right, it is better to simply return here (before the fix this code threw an exception which terminated VS).

AddTracking ( IWpfTextView wpfTextView, ITextSnapshot textSnapshot, long docCookie, Span span ) : void

Add tracking for text in span for document with id docCookie.

AttachToDocument ( string documentName, long docCookie, IVsWindowFrame frame ) : void

An overridden method for reacting to the event of a document window being opened

CanAttachToDocument ( string documentName, long docCookie, IVsWindowFrame frame ) : bool

Determines if a document can be associated with this ResultTextMarker.

Clear ( ) : void

Clear all markers and tracking classes

DetachFromDocument ( long docCookie ) : void
GetSourceLocation ( ) : Region

Get source location of current marker (tracking code place).

IsTracking ( long docCookie ) : bool

Check if current class track changes for document docCookie

RemoveHighlightMarker ( ) : void

Remove selection for tracking text

ResultTextMarker ( IServiceProvider serviceProvider, Region region, string fullFilePath ) : System

fullFilePath may be null for global issues.

SaveCurrentTrackingData ( ) : void

Save current tracking data to stored source location. If user will change, save, close and after that open document which has tracking data this class will not loose place where code exists.

Protected Methods

Method Description
OnRaiseRegionSelected ( EventArgs e ) : void

Private Methods

Method Description
AttachMarkerToTextView ( IWpfTextView textView, long docCookie, ResultTextMarker marker, int line, int column, int endLine, int endColumn ) : void

Highlight the source code on a particular line

AttachToDocumentWorker ( IVsWindowFrame frame, long docCookie ) : void

Check that current marker point to correct line position and attach it to docCookie for track changes.

CaretPositionChanged ( object sender, CaretPositionChangedEventArgs e ) : void
CreateTracking ( IWpfTextView textView, ITextSnapshot textSnapshot, Span span ) : void
GetTextViewFromFrame ( IVsWindowFrame frame ) : IVsTextView
GetWpfTextView ( IVsTextView textView ) : IWpfTextView

Helper method for getting a IWpfTextView from a IVsTextView object

IsTracking ( ) : bool
IsValidMarker ( ) : bool
NavigateTo ( bool usePreviewPane ) : IVsWindowFrame
RemoveTracking ( ) : void
SaveCurrentTrackingData ( Region sourceLocation ) : void
SubscribeToCaretEvents ( IWpfTextView textView ) : void
UpdateAtCaretPosition ( CaretPosition caretPoisition ) : void
ViewLayoutChanged ( object sender, TextViewLayoutChangedEventArgs e ) : void

Method Details

AddHighlightMarker() public method

Select current tracking text with highlightColor. If highlightColor is null than code will be selected with color from Color. If the mark doesn't support tracking changes, then we simply ignore this condition (addresses VS crash reported in Bug 476347 : Code Analysis clicking error report C6244 causes VS2012 to crash). Tracking changes helps to ensure that we nativate to the right line even if edits to the file have occured, but even if that behavior doesn't work right, it is better to simply return here (before the fix this code threw an exception which terminated VS).
public AddHighlightMarker ( string highlightColor ) : void
highlightColor string Color
return void

AddTracking() public method

Add tracking for text in span for document with id docCookie.
public AddTracking ( IWpfTextView wpfTextView, ITextSnapshot textSnapshot, long docCookie, Span span ) : void
wpfTextView IWpfTextView
textSnapshot ITextSnapshot
docCookie long
span Span
return void

AttachToDocument() public method

An overridden method for reacting to the event of a document window being opened
public AttachToDocument ( string documentName, long docCookie, IVsWindowFrame frame ) : void
documentName string
docCookie long
frame IVsWindowFrame
return void

CanAttachToDocument() public method

Determines if a document can be associated with this ResultTextMarker.
public CanAttachToDocument ( string documentName, long docCookie, IVsWindowFrame frame ) : bool
documentName string
docCookie long
frame IVsWindowFrame
return bool

Clear() public method

Clear all markers and tracking classes
public Clear ( ) : void
return void

DetachFromDocument() public method

public DetachFromDocument ( long docCookie ) : void
docCookie long
return void

GetSourceLocation() public method

Get source location of current marker (tracking code place).
public GetSourceLocation ( ) : Region
return Microsoft.CodeAnalysis.Sarif.Region

IsTracking() public method

Check if current class track changes for document docCookie
public IsTracking ( long docCookie ) : bool
docCookie long
return bool

OnRaiseRegionSelected() protected method

protected OnRaiseRegionSelected ( EventArgs e ) : void
e System.EventArgs
return void

RemoveHighlightMarker() public method

Remove selection for tracking text
public RemoveHighlightMarker ( ) : void
return void

ResultTextMarker() public method

fullFilePath may be null for global issues.
public ResultTextMarker ( IServiceProvider serviceProvider, Region region, string fullFilePath ) : System
serviceProvider IServiceProvider
region Microsoft.CodeAnalysis.Sarif.Region
fullFilePath string
return System

SaveCurrentTrackingData() public method

Save current tracking data to stored source location. If user will change, save, close and after that open document which has tracking data this class will not loose place where code exists.
public SaveCurrentTrackingData ( ) : void
return void