-
Notifications
You must be signed in to change notification settings - Fork 235
Update default PSHost console width to 120 #129
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
Comments
I mentioned this on the vscode issue but I'll repeat it here. The script output is not prematurely wrapped. This happens when I execute a command from the debug console when I'm debugging. This makes it more corner case. And I can workaround it in the debug console by executing: gci | out-string -width 120 |
I think only output formatters (Format-*) obey the console width requirements. Any calls to Write-Output will write the lines as wide as they're given. Setting the default console width to be a lot wider will fix the formatter issue. |
I think I found the method to modify: private Command GetOutputCommand(bool endOfStatement)
{
Command outputCommand =
new Command(
command: this.IsDebuggerStopped ? "Out-String" : "Out-Default",
isScript: false,
useLocalScope: true);
if (this.IsDebuggerStopped)
{
// Out-String needs the -Stream parameter added
outputCommand.Parameters.Add("Stream");
}
return outputCommand;
} If the debugger is stopped we need to use Out-String but we need to pass it the width parameter. Should I hardcode that to 120 or should that be a setting? Haven't figured out to add settings yet (and reference them from PSES code). OK updated that to: ...
if (this.IsDebuggerStopped)
{
// The default width of 79 chars is too narrow.
outputCommand.Parameters.Add("Width", 120);
// Out-String needs the -Stream parameter added
outputCommand.Parameters.Add("Stream");
}
... Works good. Now just to determine if that 120 should be a setting or not. |
You should only need to change this line: I'm pretty sure this is what's controlling the width of the output. If you change the first value from 80 to 120 it should work. The fix you're making helps for the debug adapter but we need this to work for the Run Selection (F8) command as well. |
Making a setting for this will take a bit more work because you'll have to plumb a settings object all the way down through the PSHost classes. I'd say hold off on that for now because I need to figure out a good strategy for passing settings around in the design. |
I'll give this a go tonight. Thanks for the pointer. |
Cool, thanks! |
I was messing around with debugger stuff so I made the change to see if it would work. Here's what
Since I've already made the fix, mind if I just include it with my next PR? |
Not at all. BTW don't we need to update this code as well? public override Size MaxPhysicalWindowSize
{
get { return new Size(80, 20); }
}
/// <summary>
/// Gets the maximum size of the console window.
/// </summary>
public override Size MaxWindowSize
{
get { return new Size(80, 20); }
} Also it would "ideal" if VSCode sent us a message at debug start and whenever the dbg console window dimensions (rows, cols) change during debug. Then these sizes could reflect the actual size of the dbg console. |
hah! Looks like you're working on it now too. I don't think those need to be changed, they may only get used if advanced buffer math is involved. You should submit the PR since you've been looking into it already. |
No problem. It's just that one line right? I'll submit it in a few minutes. |
Yep, just that one line. No rush at all! |
That max info does show up if you query
I don't think it would interfere with anything to keep the widths consistently 120. What do think? |
Shouldn't be a problem, go ahead and change those too |
Just about done with this. I feel like a dufus here but I just noticed the "Output" window. I had been so hung on the Debug Console. What I don't get is - what determines where script output goes? I see that it goes to the Debug Console. The only thing I see appear in the Output window is when I execute using F8. Does that sound about right? |
Yep, your understanding is correct. Debug Console is for debugger output, Output window is for F8 output. |
Fixed by commit 506d713 |
Didn't know that. Thanks for the tip! |
Yep, you can write it anywhere in the message. Sometimes I write it in the top line, other times I write it on its own line at the end of the commit message. It's pretty smart about picking those up. |
Now that VS Code shows the Debug Console and Output Window in a horizontal window it makes sense to increase the default width of the PSHost so that more text can be displayed on a single line.
The text was updated successfully, but these errors were encountered: