Skip to content

Commit

Permalink
Turn off "Cody Agent" output pane switching (activating) after every …
Browse files Browse the repository at this point in the history
…error (#46)

CLOSE
https://linear.app/sourcegraph/issue/CODY-3334/stop-agent-cody-output-pane-showing-every-time-when-there-is-an-error

Turn off "Cody Agent" output pane switching (activating) for every error logged which makes debugging experience less annoying.
  • Loading branch information
PiotrKarczmarz authored Aug 16, 2024
1 parent f4c7d03 commit 5fcf37b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Cody.VisualStudio/CodyPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke
private void InitializeServices()
{
var loggerFactory = new LoggerFactory();
AgentLogger = loggerFactory.Create(WindowPaneLogger.CodyAgent);
Logger = loggerFactory.Create("Cody");
AgentLogger = loggerFactory.Create("Cody agent");

var vsSolution = this.GetService<SVsSolution, IVsSolution>();
SolutionService = new SolutionService(vsSolution);
VersionService = loggerFactory.GetVersionService();
Expand Down
6 changes: 5 additions & 1 deletion src/Cody.VisualStudio/Infrastructure/WindowPaneLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ namespace Cody.VisualStudio.Inf
{
public class WindowPaneLogger : IOutputWindowPane
{
public static string CodyAgent = "Cody Agent";

private readonly IVsOutputWindow _outputWindow;
private readonly IVsOutputWindowPane _pane;

private Guid _guid = Guid.NewGuid();
private string _name;

public WindowPaneLogger(IVsOutputWindow outputWindow, string name)
{
_outputWindow = outputWindow;
_name = name;

if (_outputWindow.GetPane(_guid, out _pane) != VSConstants.S_OK)
{
Expand Down Expand Up @@ -60,7 +64,7 @@ public void Error(string message, string callerName)
Log(message, "Error", callerName);

#if DEBUG
if (_pane != null)
if (_pane != null && _name != CodyAgent)
_pane.Activate();
#endif
}
Expand Down

0 comments on commit 5fcf37b

Please sign in to comment.