Skip to content

Commit

Permalink
Merge pull request #467 from Matt-17/master
Browse files Browse the repository at this point in the history
Added Write without new line to OutputWindowPane
  • Loading branch information
madskristensen committed Nov 13, 2023
2 parents cb2f77d + f30bbc5 commit 4fa5cfc
Showing 1 changed file with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,18 @@ public void WriteLine(string value)
});
}

/// <summary>
/// Writes the given text to the Output window pane.
/// </summary>
/// <param name="value">The text value to write.</param>
public void Write(string value)
{
ThreadHelper.JoinableTaskFactory.Run(async () =>
{
await WriteAsync(value);
});
}

/// <summary>
/// Writes a new line to the Output window pane.
/// </summary>
Expand All @@ -249,6 +261,15 @@ public Task WriteLineAsync()
/// </summary>
/// <param name="value">The text value to write. May be an empty string, in which case a newline is written.</param>
public async Task WriteLineAsync(string value)
{
await WriteAsync(value + Environment.NewLine);
}

/// <summary>
/// Writes the given text to the Output window pane.
/// </summary>
/// <param name="value">The text value to write.</param>
public async Task WriteAsync(string value)
{
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

Expand All @@ -261,11 +282,11 @@ public async Task WriteLineAsync(string value)

if (_pane is IVsOutputWindowPaneNoPump nopump)
{
nopump.OutputStringNoPump(value + Environment.NewLine);
nopump.OutputStringNoPump(value);
}
else
{
ErrorHandler.ThrowOnFailure(_pane.OutputStringThreadSafe(value + Environment.NewLine));
ErrorHandler.ThrowOnFailure(_pane.OutputStringThreadSafe(value));
}
}

Expand Down

0 comments on commit 4fa5cfc

Please sign in to comment.