Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Write without new line to OutputWindowPane #467

Merged
merged 2 commits into from
Nov 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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