Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit b805eb4

Browse files
fix #405: SymbolTypeAtCaretConditionEvaluator and CaretReferenceHighlightRenderer should use delayed resolve call
1 parent d3a0632 commit b805eb4

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/AddIns/BackendBindings/CSharpBinding/Project/Src/CaretReferenceHighlightRenderer.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
using System.Linq;
2222
using System.Threading;
2323
using System.Windows.Media;
24+
using System.Windows.Threading;
2425
using ICSharpCode.AvalonEdit.Document;
2526
using ICSharpCode.AvalonEdit.Rendering;
2627
using ICSharpCode.NRefactory;
@@ -43,6 +44,7 @@ class CaretReferenceHighlightRenderer : IDisposable, IBackgroundRenderer
4344

4445
ISymbolReference currentSymbolReference;
4546
CancellationTokenSource caretMovementTokenSource;
47+
DispatcherTimer timer;
4648
List<ISegment> currentReferences;
4749

4850
Pen borderPen;
@@ -63,6 +65,11 @@ public CaretReferenceHighlightRenderer(ITextEditor editor)
6365
this.backgroundBrush = new SolidColorBrush(DefaultFillColor);
6466
this.borderPen.Freeze();
6567
this.backgroundBrush.Freeze();
68+
this.timer = new DispatcherTimer {
69+
Interval = TimeSpan.FromMilliseconds(500)
70+
};
71+
timer.Tick += (sender, e) => ResolveAtCaret();
72+
6673
editor.Caret.LocationChanged += CaretLocationChanged;
6774
textView.VisualLinesChanged += VisualLinesChanged;
6875
SD.ParserService.ParseInformationUpdated += ParseInformationUpdated;
@@ -134,6 +141,13 @@ void LoadSolutionProjectsThreadFinished(object sender, EventArgs e)
134141

135142
void CaretLocationChanged(object sender, EventArgs e)
136143
{
144+
timer.Stop();
145+
timer.Start();
146+
}
147+
148+
void ResolveAtCaret()
149+
{
150+
timer.Stop();
137151
if (caretMovementTokenSource != null)
138152
caretMovementTokenSource.Cancel();
139153
caretMovementTokenSource = new CancellationTokenSource();

0 commit comments

Comments
 (0)