Skip to content

Add customize output color enhancement #654

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

Merged
merged 4 commits into from
Apr 21, 2018

Conversation

KeroroLulu
Copy link
Contributor

@KeroroLulu KeroroLulu commented Apr 20, 2018

With this, if the user change his PrivateData's color properties it will be print with the color that the user choose.

Edit

Sorry I touched .travis.ymlbecause I had some problem with travis but finally it didn't change. To resolve this problem I just put XML comment, that was from the copy/past from PowerShell repositorie.

fixes #651

@msftclas
Copy link

msftclas commented Apr 20, 2018

CLA assistant check
All CLA requirements met.

Supress Warnings in travis

Supress Warning in Travis PowerShell#2

Test for travis

Add Comment XML for travis

Add Comment for Testing
@KeroroLulu KeroroLulu changed the title Add customize output color enhancement (#651) Add customize output color enhancement Apr 20, 2018
@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Apr 20, 2018

Nice work @KeroroLulu 🎉 looking forward to reviewing this!

Copy link
Collaborator

@SeeminglyScience SeeminglyScience left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for taking this one @KeroroLulu! A couple minor requests due to some differences in this project versus Core.

///
///
/// </summary>
public class ConsoleColorProxy
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be internal class ConsoleColorProxy since the only intended way to access it is via the PSObject. The empty documentation comment can then be removed as well

Copy link
Contributor Author

@KeroroLulu KeroroLulu Apr 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SeeminglyScience Sorry I delete my comments in your review, afterwards I notice that the error I get with travis was from public members. I didn't notice that it work with internal members. And when I pushed that change AppVeyor worked I don't know why it was stuck for 20 minute.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor and Travis sometimes have issues (not our issues) and it's just a matter of restarting the build and it works. 😀

/// <summary>
///
/// </summary>
public ConsoleColorProxy(EditorServicesPSHostUserInterface hostUserInterface)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be internal ConsoleColorProxy(EditorServicesPSHostUserInterface hostUserInterface) , the empty documentation comment can then be removed as well

/// </summary>
public ConsoleColor ErrorForegroundColor
{
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the diagnostic suppressions (SuppressMessage) can be removed since we don't have the same analyzers on the project

/// <summary>
///
/// </summary>
public static ConsoleColor BackgroundColor
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the color properties here can be internal, the empty documentation comments can then be removed as well.

{
get;
set;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should follow the same style as below (e.g. public static ConsoleColor BackgroundColor { get; set; })

@@ -6,6 +6,7 @@
using Microsoft.PowerShell.EditorServices.Session;
using Microsoft.PowerShell.EditorServices.Utility;
using System;
using System.Diagnostics.CodeAnalysis;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed after the SuppressMessage attributes are removed.

GUIGHIL benjamin added 2 commits April 20, 2018 14:52
I added all internal class and suppress all the SuppressMessage.
But I can't remove the empty documentation, the analysis of
PowerShell Editor Services doesn't let it pass. I tried to add
the suppress warning in it but it doesn't work as well. So I had to
add all documentation.
Sorry I didn't notice that was only for public members until I read
the error again.
@TylerLeonhardt
Copy link
Member

@KeroroLulu do you think you could upload a picture of it working? I'm really curious to see it 😃

@KeroroLulu
Copy link
Contributor Author

KeroroLulu commented Apr 20, 2018

@tylerl0706 Here the screenshot :

capture d ecran 2018-04-20 a 17 23 51

capture d ecran 2018-04-20 a 17 24 02

I changed the value of PrivateData and then print the error and it uses the new color.

Edit

I did it from Visual Studio Code.

Copy link
Member

@TylerLeonhardt TylerLeonhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!! 🎉

Awesome work @KeroroLulu! Thank you so much for contributing 😀

You're going to make a lot of folks happy with this change because VSCode needed a way to change colors of errors so that when people give presentations there's enough contrast.

I will wait to hear what @SeeminglyScience has to say about your revisions 😁


/// <summary>
///
/// </summary>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you either remove these summaries or add like

"The ForegroundColor for Errors"
etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add text, I think that your configuration of travis doesn't accept warning from XML documentation for public members

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good!

@rjmholt
Copy link
Contributor

rjmholt commented Apr 20, 2018

I think we need to make sure this compiles on .NET Core Just realised Travis does that. I was under the impression that ConsoleColor was .NET Framework only for some reason...

@rjmholt
Copy link
Contributor

rjmholt commented Apr 20, 2018

Looks good to me!

@TylerLeonhardt
Copy link
Member

verified this on macOS 😁

@KeroroLulu
Copy link
Contributor Author

I'm on MacOS too x)

@SeeminglyScience
Copy link
Collaborator

Changes look great! Thanks again this is a big help :)

@KeroroLulu
Copy link
Contributor Author

Should I squash my commit ?

@TylerLeonhardt TylerLeonhardt merged commit e37f1f2 into PowerShell:master Apr 21, 2018
@TylerLeonhardt
Copy link
Member

Merged 😄 Thanks again!!

I tweeted about the PR here:
https://twitter.com/TylerLeonhardt/status/987715764248498176

@KirkMunro
Copy link

@KeroroLulu Thank you very much for this improvement! This is something that has been needed in VS Code for a long time! 😀

@TylerLeonhardt
Copy link
Member

It will be available in the next release which I'm going to try to get out next week :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

We need a way to customize output color for error/warning, etc
6 participants