Skip to content

Commit

Permalink
In progress
Browse files Browse the repository at this point in the history
  • Loading branch information
CyrusNajmabadi committed Dec 19, 2024
1 parent 0f2abb6 commit 632cfc4
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions src/EditorFeatures/Core.Wpf/InlineHints/InlineHintsTagger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,13 @@ public override void AddTags(
cache = _cache_doNotAccessOutsideOfGate;
}

var cacheBuilder = cache.ToBuilder();

// If the snapshot has changed, we can't use any of the cached data, as it is associated with the
// original snapshot they were created against.
var snapshot = spans[0].Snapshot;

var cacheChanged = false;
var cacheBuilder = cache.ToBuilder();

if (snapshot != cacheSnapshot)
{
cacheBuilder.Clear();
cacheChanged = true;
}

var document = snapshot.GetOpenDocumentInCurrentContextWithChanges();
var classify = document != null && _taggerProvider.EditorOptionsService.GlobalOptions.GetOption(InlineHintsViewOptionsStorage.ColorHints, document.Project.Language);
Expand All @@ -185,7 +180,6 @@ public override void AddTags(
{
inlineHintTags = new(dataTagSpan);
cacheBuilder[position] = inlineHintTags;
cacheChanged = true;
}

if (seenPositions.Add(position))
Expand All @@ -202,14 +196,11 @@ public override void AddTags(
}
}

if (cacheChanged)
cache = cacheBuilder.ToImmutable();
lock (_gate)
{
cache = cacheBuilder.ToImmutable();
lock (_gate)
{
_cacheSnapshot_doNotAccessOutsideOfGate = snapshot;
_cache_doNotAccessOutsideOfGate = cache;
}
_cacheSnapshot_doNotAccessOutsideOfGate = snapshot;
_cache_doNotAccessOutsideOfGate = cache;
}
}
catch (Exception e) when (FatalError.ReportAndPropagateUnlessCanceled(e, ErrorSeverity.General))
Expand Down

0 comments on commit 632cfc4

Please sign in to comment.