/// <summary> /// In the code editor, highlights all references to the expression under the caret (for better code readability). /// </summary> public CaretReferencesRenderer(CodeEditorView editorView) { this.editorView = editorView; this.highlightRenderer = new ExpressionHighlightRenderer(this.editorView.TextArea.TextView); this.delayTimer = new DispatcherTimer() { Interval = TimeSpan.FromMilliseconds(delayMs) }; this.delayTimer.Stop(); this.delayTimer.Tick += TimerTick; this.delayMoveTimer = new DispatcherTimer() { Interval = TimeSpan.FromMilliseconds(delayMoveMs) }; this.delayMoveTimer.Stop(); this.delayMoveTimer.Tick += TimerMoveTick; this.editorView.TextArea.Caret.PositionChanged += CaretPositionChanged; }
/// <summary> /// In the code editor, highlights all references to the expression under the caret (for better code readability). /// </summary> public CaretReferencesRenderer(CodeEditorView editorView) { this.editorView = editorView; this.highlightRenderer = new ExpressionHighlightRenderer(this.editorView.TextArea.TextView); this.delayTimer = new DispatcherTimer() { Interval = TimeSpan.FromMilliseconds(delayMs) }; this.delayTimer.Stop(); this.delayTimer.Tick += TimerTick; this.delayMoveTimer = new DispatcherTimer() { Interval = TimeSpan.FromMilliseconds(delayMoveMs) }; this.delayMoveTimer.Stop(); this.delayMoveTimer.Tick += TimerMoveTick; this.editorView.TextArea.Caret.PositionChanged += CaretPositionChanged; // fixes SD-1873 - Unhandled WPF Exception when deleting text in text editor // clear highlights to avoid exceptions when trying to draw highlights in // locations that have been deleted already. this.editorView.Document.Changed += delegate { lastResolveResult = null; ClearHighlight(); }; }