Skip to content

Commit

Permalink
Exposed debug on azd
Browse files Browse the repository at this point in the history
  • Loading branch information
timheuer committed Dec 19, 2023
1 parent a176653 commit 0c9c3e4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Commands/InfraSynth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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"));
Expand Down
6 changes: 6 additions & 0 deletions src/Options/General.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,10 @@ public class General : BaseOptionModel<General>
[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;
}

0 comments on commit 0c9c3e4

Please sign in to comment.