Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/Infrastructure.VS/DocumentEvents/ActiveDocumentTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,26 +93,26 @@ public ActiveDocumentTracker(
///
/// To support all the cases, we use SEID_DocumentFrame for uses cases 1-3 and SEID_WindowFrame for use case 4.
/// </summary>
int IVsSelectionEvents.OnElementValueChanged(uint elementId, object oldValue, object newValue)
int IVsSelectionEvents.OnElementValueChanged(uint elementid, object varValueOld, object varValueNew)
{
threadHandling.ThrowIfNotOnUIThread();

if (elementId == (uint)VSConstants.VSSELELEMID.SEID_DocumentFrame)
if (elementid == (uint)VSConstants.VSSELELEMID.SEID_DocumentFrame)
{
ITextDocument activeTextDoc = null;

if (newValue is IVsWindowFrame newWindowFrame)
if (varValueNew is IVsWindowFrame newWindowFrame)
{
activeTextDoc = textDocumentProvider.GetFromFrame(newWindowFrame);
}

// The "active document" will be null if the last document has just been closed
NotifyActiveDocumentChanged(activeTextDoc);
}
// if we reached here, we know that oldValue and/or newValue are a tool window,
// if we reached here, we know that varValueOld and/or varValueNew are a tool window,
// and we are only interested in the use case of [tool window] -> [doc]
else if (elementId == (uint) VSConstants.VSSELELEMID.SEID_WindowFrame &&
newValue is IVsWindowFrame newWindowFrame && IsDocumentFrame(newWindowFrame))
else if (elementid == (uint) VSConstants.VSSELELEMID.SEID_WindowFrame &&
varValueNew is IVsWindowFrame newWindowFrame && IsDocumentFrame(newWindowFrame))
{
var activeTextDoc = textDocumentProvider.GetFromFrame(newWindowFrame);
NotifyActiveDocumentChanged(activeTextDoc);
Expand Down
10 changes: 8 additions & 2 deletions src/IssueViz/Editor/ErrorTagging/ErrorTagTooltipProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

using System;
using System.ComponentModel.Composition;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
Expand Down Expand Up @@ -94,12 +95,17 @@ public object Create(IAnalysisIssueBase analysisIssueBase)
Foreground = GetVsThemedColor(EnvironmentColors.SystemCaptionTextBrushKey)
};

instanceCount++;
logger.LogVerbose($"[ErrorTagTooltipProvider] tooltip instance count: {instanceCount}");
var currentCount = IncrementInstanceCount();
logger.LogVerbose($"[ErrorTagTooltipProvider] tooltip instance count: {currentCount}");

return content;
}

private static long IncrementInstanceCount()
{
return Interlocked.Increment(ref instanceCount);
}

private static void ApplyHyperlinkStyle(Hyperlink hyperlink)
{
// Style the hyperlink to behave like other error tooltips i.e.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ private IReadOnlyList<ILocationListItem> BuildLocationListItems(IAnalysisIssueFl

if (flowLocations != null && flowLocations.Any())
{
for (var i = 0; i < flowLocations.Count; i++)
var i = 0;
while (i < flowLocations.Count)
{
var location = flowLocations[i];

Expand All @@ -317,7 +318,7 @@ private IReadOnlyList<ILocationListItem> BuildLocationListItems(IAnalysisIssueFl

listItems.AddRange(sequentialLocations.Select(x => (ILocationListItem)new LocationListItem(x)));

i += sequentialLocations.Count - 1;
i += sequentialLocations.Count;
}
}

Expand Down