-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Add ConciseView for $ErrorView #10641
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
Conversation
…ave existing NormalView and CategoryView.
… in a single line
…age, fix display of remote errors for Concise and Normal views
|
@SteveL-MSFT would it make sense to color the token / ast element in the quoted line(s) that caused the error in red? For parse exceptions, maybe highlighting everything after the point it occurs is best, but having the troublesome cmdlet or argument highlighted in red may make this significantly more readable, and obviates the need for an arrow pointing at it, which (in conjunction with leading whitespace) takes up space that may be needed to display the error message itself. |
|
@vexx32 there are certainly other visualization improvements we could consider. One concern about using some highlight on the section in question without the arrow pointing is that it wouldn't work well on systems that don't support vt100. The current solution will detect the terminal doesn't support VT and simply omit the color codes but the content is still consumable. |
|
@SteveL-MSFT understood, but I imagine combining the arrow with a highlight probably is still a good idea for VT-enabled terminals? 🙂 |
|
@vexx32 let me try something to see how it looks |
|
@JamesWTruher Can you please review this when you get a chance? Thank you. |
|
@SteveL-MSFT very nice! Could we potentially have the first line mention It would also be nice to put on the board for the future that you could have |
|
@vexx32 don't have a way yet to determine if terminating or non-terminating, when that eventually shows up, we can update this. I change the text to |
|
@vexx32 checkout the updated image above. I wonder if |
|
@SteveL-MSFT yeah I'd say that's a good idea. |
I don't think it adds much to display |
…ages where the width didn't take into account vt100 code characters
|
@rkeithhill it makes the file path pop out more, but I'm ok either way |
JamesWTruher
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there's anything blocking other than the actual bugs in the string truncator
...stem.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs
Outdated
Show resolved
Hide resolved
...stem.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs
Show resolved
Hide resolved
...stem.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs
Outdated
Show resolved
Hide resolved
...stem.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs
Show resolved
Hide resolved
...stem.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs
Show resolved
Hide resolved
...stem.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs
Show resolved
Hide resolved
Co-Authored-By: James Truher [MSFT] <jimtru@microsoft.com>
|
The era of color |
PR Summary
Add new
ConciseViewas Experimental Feature. When this ExperimentalFeature is enabled, it defaults toConciseView, otherwise, it defaults toNormalView.CategoryViewis still supported.With new
ConciseView, if the error is not from a script or parser error, then it's a single line error message. Otherwise, you get a multiline error message that isn't all red showing the script file (if available), linethat contains the error and a pointer and error message showing where the error is in that line. If the terminal doesn't support Virtual Terminal, then vt100 color codes are not used. The error message within the line display will wrap at whitespace making it easier to read.
A new
$Host.PrivateData.ErrorAccentColormember is added so users can customize the color.$ErrorViewis now of type[System.Management.Automation.ErrorView]instead of a string.Some cleanup to the formatting script with regards to double double quotes vs single quotes where appropriate. Also changed the PositionMessage when truncating to use unicode ellipsis instead of 3 dots.
PR Context
Implement $ErrorView part of PowerShell/PowerShell-RFC#228
Fix #3647
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.