From 0c9c3e4d2230f3dbf8590c21d4b48f9f90be4a0a Mon Sep 17 00:00:00 2001 From: Tim Heuer Date: Tue, 19 Dec 2023 15:21:25 -0800 Subject: [PATCH] Exposed debug on azd --- src/Commands/InfraSynth.cs | 6 +++++- src/Options/General.cs | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Commands/InfraSynth.cs b/src/Commands/InfraSynth.cs index 0c49d24..76eb348 100644 --- a/src/Commands/InfraSynth.cs +++ b/src/Commands/InfraSynth.cs @@ -23,14 +23,17 @@ protected override async Task ExecuteAsync(OleMenuCmdEventArgs e, Project projec var stdOutBuffer = new StringBuilder(); var stdErrBuffer = new StringBuilder(); OutputWindowPane pane = await VS.Windows.GetOutputWindowPaneAsync(Community.VisualStudio.Toolkit.Windows.VSOutputWindowPane.General); + var options = await General.GetLiveInstanceAsync(); var projectPath = FindAzureYaml(project.FullPath); await VS.StatusBar.StartAnimationAsync(StatusAnimation.Sync); await VS.StatusBar.ShowProgressAsync(STATUS_MESSAGE, 1, 2); + var command = $"infra synth --force --no-prompt" + (options.AzdDebug ? " --debug" : ""); + var result = await Cli.Wrap("azd") - .WithArguments($"infra synth --force --no-prompt") + .WithArguments(command) .WithWorkingDirectory(projectPath) .WithStandardOutputPipe(PipeTarget.ToStringBuilder(stdOutBuffer)) .WithStandardErrorPipe(PipeTarget.ToStringBuilder(stdErrBuffer)) @@ -47,6 +50,7 @@ protected override async Task ExecuteAsync(OleMenuCmdEventArgs e, Project projec else { await pane.WriteLineAsync($"[AZD]: infra synth completed"); + await pane.WriteLineAsync($"[AZD]: {stdOutBuffer}"); } await VS.Documents.OpenAsync(Path.Combine(projectPath, "infra", "resources.bicep")); diff --git a/src/Options/General.cs b/src/Options/General.cs index 0ea1e62..9e00392 100644 --- a/src/Options/General.cs +++ b/src/Options/General.cs @@ -22,4 +22,10 @@ public class General : BaseOptionModel [Description("Use a temporary file on disk instead of project location")] [DefaultValue(true)] public bool UseTempFile { get; set; } = true; + + [Category("Manifest file")] + [DisplayName("Enable azd debug output")] + [Description("Enables azd debug output (--debug) to the infra synth")] + [DefaultValue(false)] + public bool AzdDebug { get; set; } = false; } \ No newline at end of file