Skip to content

Commit 5f6aa47

Browse files
Fixed compilation issue
1 parent a5db785 commit 5f6aa47

3 files changed

Lines changed: 48 additions & 39 deletions

File tree

ast-visual-studio-extension/CxExtension/CxAssist/Core/CopilotIntegration.cs

Lines changed: 14 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -377,64 +377,45 @@ private static IVsWindowFrame TryCaptureAssistDocumentFrame()
377377
private static void ShowCopilotNotAgentModeUserMessage(IVsWindowFrame assistDocumentFrame)
378378
{
379379
ThreadHelper.ThrowIfNotOnUIThread();
380-
AssistDocumentInfoBar.TryShowWarning(
381-
assistDocumentFrame,
380+
ShowAssistNotification(
382381
CxAssistConstants.CopilotNotAgentModeInfoBarMessage,
383-
() => ShowAssistNotification(
384-
CxAssistConstants.CopilotNotAgentModeInfoBarMessage,
385-
isError: false,
386-
useWarningSeverity: true));
382+
isError: false,
383+
useWarningSeverity: true);
387384
}
388385

389386
/// <summary>
390387
/// Shows Copilot not installed warning in the info bar.
391388
/// </summary>
392389
private static void ShowCopilotNotInstalledMessage(IVsWindowFrame assistDocumentFrame)
393390
{
394-
if (assistDocumentFrame == null) return;
395391
ThreadHelper.ThrowIfNotOnUIThread();
396-
AssistDocumentInfoBar.TryShowWarning(
397-
assistDocumentFrame,
392+
ShowAssistNotification(
398393
CxAssistConstants.CopilotNotInstalledInfoBarMessage,
399-
() => ShowAssistNotification(
400-
CxAssistConstants.CopilotNotInstalledInfoBarMessage,
401-
isError: false,
402-
useWarningSeverity: true));
394+
isError: false,
395+
useWarningSeverity: true);
403396
}
404397

405398
/// <summary>
406399
/// Shows Copilot Chat failed to open warning in the info bar.
407400
/// </summary>
408401
private static void ShowCopilotChatOpenFailedMessage(IVsWindowFrame assistDocumentFrame)
409402
{
410-
if (assistDocumentFrame == null) return;
411403
ThreadHelper.ThrowIfNotOnUIThread();
412-
AssistDocumentInfoBar.TryShowWarning(
413-
assistDocumentFrame,
404+
ShowAssistNotification(
414405
CxAssistConstants.CopilotChatOpenFailedInfoBarMessage,
415-
() => ShowAssistNotification(
416-
CxAssistConstants.CopilotChatOpenFailedInfoBarMessage,
417-
isError: false,
418-
useWarningSeverity: true));
406+
isError: false,
407+
useWarningSeverity: true);
419408
}
420409

421410
/// <summary>
422411
/// Shows Copilot prompt preparation failed error in the info bar (as warning with error fallback).
423412
/// </summary>
424413
private static void ShowCopilotPromptPrepareFailedMessage(IVsWindowFrame assistDocumentFrame)
425414
{
426-
if (assistDocumentFrame == null)
427-
{
428-
ShowAssistNotification(CxAssistConstants.CopilotPromptPrepareFailedInfoBarMessage, isError: true);
429-
return;
430-
}
431415
ThreadHelper.ThrowIfNotOnUIThread();
432-
AssistDocumentInfoBar.TryShowWarning(
433-
assistDocumentFrame,
416+
ShowAssistNotification(
434417
CxAssistConstants.CopilotPromptPrepareFailedInfoBarMessage,
435-
() => ShowAssistNotification(
436-
CxAssistConstants.CopilotPromptPrepareFailedInfoBarMessage,
437-
isError: true));
418+
isError: true);
438419
}
439420

440421
/// <summary>
@@ -443,15 +424,11 @@ private static void ShowCopilotPromptPrepareFailedMessage(IVsWindowFrame assistD
443424
/// </summary>
444425
private static void ShowCopilotPasteOnlyVs2026Message(IVsWindowFrame assistDocumentFrame)
445426
{
446-
if (assistDocumentFrame == null) return;
447427
ThreadHelper.ThrowIfNotOnUIThread();
448-
AssistDocumentInfoBar.TryShowWarning(
449-
assistDocumentFrame,
428+
ShowAssistNotification(
450429
CxAssistConstants.CopilotPasteOnlyVs2026InfoBarMessage,
451-
() => ShowAssistNotification(
452-
CxAssistConstants.CopilotPasteOnlyVs2026InfoBarMessage,
453-
isError: false,
454-
useWarningSeverity: true));
430+
isError: false,
431+
useWarningSeverity: true);
455432
}
456433

457434
private static void ScheduleAutomatedPromptEntry(string prompt, IVsWindowFrame assistDocumentFrame)

ast-visual-studio-extension/CxExtension/CxAssist/Core/CxAssistDisplayCoordinator.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,5 +357,39 @@ public static void RefreshProblemWindow(
357357
findingsControl.SetAllFileNodes(fileNodes);
358358
}, "Coordinator.RefreshProblemWindow");
359359
}
360+
361+
/// <summary>
362+
/// Clears all findings from the coordinator.
363+
/// Used when user logs out or disables all scanners.
364+
/// </summary>
365+
public static void ClearAllFindings()
366+
{
367+
lock (_lock)
368+
{
369+
_fileToIssues.Clear();
370+
}
371+
IssuesUpdated?.Invoke(new Dictionary<string, List<Vulnerability>>());
372+
}
373+
374+
/// <summary>
375+
/// Clears findings from disabled scanners only.
376+
/// Called when user toggles a scanner off via preferences.
377+
/// </summary>
378+
public static void ClearFindingsFromDisabledScanners()
379+
{
380+
lock (_lock)
381+
{
382+
foreach (var filePath in _fileToIssues.Keys.ToList())
383+
{
384+
_fileToIssues[filePath] = _fileToIssues[filePath]
385+
.Where(v => v != null && v.Scanner != 0)
386+
.ToList();
387+
388+
if (_fileToIssues[filePath].Count == 0)
389+
_fileToIssues.Remove(filePath);
390+
}
391+
}
392+
IssuesUpdated?.Invoke(GetAllIssuesByFile());
393+
}
360394
}
361395
}

ast-visual-studio-extension/ast-visual-studio-extension.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@
121121
<Compile Include="CxExtension\Toolbar\ProjectsCombobox.cs" />
122122
<Compile Include="CxExtension\Toolbar\ScansCombobox.cs" />
123123
<Compile Include="CxExtension\Toolbar\CxToolbar.cs" />
124-
<Compile Include="CxExtension\CxAssist\Core\EditorBufferResolver.cs" />
125124
<Compile Include="CxExtension\Utils\OutputPaneUtils.cs" />
126125
<Compile Include="CxExtension\Utils\OutputPaneWriter.cs" />
127126
<Compile Include="CxExtension\Utils\RepositoryInformation.cs" />
@@ -207,7 +206,6 @@
207206
<Compile Include="CxExtension\CxAssist\Core\AssistIconLoader.cs" />
208207
<Compile Include="CxExtension\CxAssist\Core\CxAssistOutputPane.cs" />
209208
<Compile Include="CxExtension\CxAssist\Core\CxAssistErrorHandler.cs" />
210-
<Compile Include="CxExtension\CxAssist\Core\AssistDocumentInfoBar.cs" />
211209
<Compile Include="CxExtension\CxAssist\Core\CopilotIntegration.cs" />
212210
<Compile Include="CxExtension\CxAssist\Core\CxAssistCopilotActions.cs" />
213211
<Compile Include="CxExtension\CxAssist\Core\Prompts\CxOneAssistFixPrompts.cs" />

0 commit comments

Comments
 (0)