GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||
GeezerVison is showing github.com — Enable simpler ANSI formatting via `$PSStyle` and support suppressing ANSI output by SteveL-MSFT · Pull Request #13758 · PowerShell/PowerShell Conversation
|
|
Still need to add tests |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 15 days. It will be closed if no further activity occurs within 10 days of this comment. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Still need to have WriteVerbose, etc... use the $PSStyle settings before taking this out of draft |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I really like this PR! It will be super useful to me! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Publish my comments so far, will continue to review.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
So will output red colored string. In time of evaluating the string we already know values of all constants - SupportsVirtualTerminal, isHost, Console.IsOutputRedirected. If so why do we need the filtering at all if we can return $null at the evaluating time if we do not need the ANSI value? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Ilya (@iSazonov) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if (!InternalTestHooks.BypassOutputRedirectionCheck && | ||
| ((PSStyle.Instance.OutputRendering == OutputRendering.PlainText) || | ||
| (formatStyle == FormatStyle.Error && Console.IsErrorRedirected) || | ||
| (formatStyle != FormatStyle.Error && Console.IsOutputRedirected))) |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Steve Lee (@SteveL-MSFT), this method currently directly check on Console.IsErrorRedirected and Console.IsOutputRedirected. I think we shouldn't directly check on those in PowerShell engine, but should instead have separate parameters for the caller to provide that information. The engine should not assume there is a console available, and it's up to the host implementation to pass in whether there is error/output redirection when calling this method.
I've put this comment in the tracking issue #14387, so you can fix it in a separate PR.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Steve Lee (@SteveL-MSFT) I say that $PSStyle could not be a const and be evaluated - as result we have no need to filter out escapes because $PSStyle would return $null if user turns off coloring or terminal does not support escapes and so on. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Ilya (@iSazonov) The PowerShell engine doesn't know if the output/error is being reidrected. It cannot depedn on Take the host implementation of the PowerShell sub kernel (jupyter kernel) in .NET Interactive as an instance, it's a console application, and the process's output/error streams are always redirected to send to the frontend -- jupyter notebook, which is capable of handling ANSI sequences. So, in this case, even thought To summarize, the host implementation has the final call on whether ANSI sequences should be stripped off or not, and that's why I opened #14387. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Why can't PowerShell engine get this information from the host implementation?
So PowerShell engine can get get this information from the host implementation? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I don't know how that would work and how well that would work if it works.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Ilya (@iSazonov) I will merge this PR to make the cut of 7.2.0-preview.2 release build. Feel free to comment in #14387 about how you think this feature can be improved. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
🎉 Handy links: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
These changes don't seem to work in the Integrated Console: #14435 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
ANSI escape handling and PowerShell
There was an error while loading. Please reload this page.