Skip to content

Commit e3c00d9

Browse files
tomaszgolebiowskiTomasz Gołębiowski
andauthored
Restoring the status icon in VS 2026 (#385)
The new version of Visual Studio changed the way the main window loads, which resulted in the status icon not being visible in the status bar. This PR fixes the situation so that the icon is visible in both versions 2022 and 2026. ## Test plan Launch Visual Studio 2026 and check if the status icon appears in the status bar. <!-- REQUIRED; info at https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles --> --------- Co-authored-by: Tomasz Gołębiowski <tgolebiowski@virtuslab.com>
1 parent e5f6d67 commit e3c00d9

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/Cody.VisualStudio.Tests/SmartApplyTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ private async Task ApplyLastSuggestionFor(string chatText)
9797
if (hasHiddenClass)
9898
await apply.EvaluateAsync("element => element.classList.remove('tw-hidden')");
9999

100-
await apply.ClickAsync(new() { Force = true});
100+
await apply.ClickAsync(new() { Force = true });
101101

102102
await EditAppliedAsync();
103103
}

src/Cody.VisualStudio/Services/StatusbarService.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ private void InitializeCodyIcon()
8484
stackPanel = new StackPanel()
8585
{
8686
Orientation = Orientation.Horizontal,
87-
Margin = new Thickness(0, 0, 10, 0),
87+
Margin = new Thickness(5, 0, 10, 0),
8888
};
8989

9090
codyIcon = new Image()
@@ -108,9 +108,18 @@ private void InitializeCodyIcon()
108108
DockPanel.SetDock(stackPanel, Dock.Right);
109109
stackPanel.MouseUp += (sender, args) => CodyStatusIconClicked?.Invoke(codyIcon, EventArgs.Empty);
110110

111+
var mainWindow = Application.Current.MainWindow;
112+
113+
if (mainWindow.IsLoaded) InjectControlIntoStatusbar();
114+
else mainWindow.Loaded += (sender, args) => InjectControlIntoStatusbar();
115+
116+
}
117+
118+
private void InjectControlIntoStatusbar()
119+
{
111120
var resizeGripControl = Utilities.UIHelper.FindChild<Control>(Application.Current.MainWindow, "ResizeGripControl");
112121
var dockPanel = resizeGripControl.Parent as DockPanel;
113-
dockPanel.Children.Insert(2, stackPanel);
122+
dockPanel.Children.Insert(1, stackPanel);
114123
}
115124

116125
private void SetTextBlockForegroundColor()

0 commit comments

Comments
 (0)