-
Notifications
You must be signed in to change notification settings - Fork 360
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
Idea: use ANSI colors to highlight annotation differences #3623
Comments
Thanks for the suggestion. To clarify: this is a suggestion about the Checker Framework's regular output, not about the output of the Checker Framework's test suite. And this suggestion would affect the Checker Framework's output only when a user uses Gradle (such as https://github.com/kelloggm/checkerframework-gradle-plugin) to run the Checker Framework, but not when the Checker Framework is run using Maven, Ant, javac, etc. Do I understand your proposal? I agree that a message like this:
is unnecessarily wordy. #2276 is a feature request to change that message to
The logic needed to implement #2276 might also be useful for implementing your suggestion. To give benefits to users who are not using Gradle, would it be helpful to add a row of carets under the currently-printed messages, like the following? That could share code with your proposal.
|
I thought that you use the same output formatting for both Maven, Gradle, and other plugins, so I guess you could improve formatter once and improve messages for all the users. I use Checker Framework via Gradle only, however, that does not imply I want something Gradle-specific. Gradle was just an example. |
Just to clarify: coloring works universal across Maven, Gradle, and others, and it is quite easy to implement (see https://en.wikipedia.org/wiki/ANSI_escape_code ). The most complicated part for me was to select the colors that work well by default :) |
That would indeed help (e.g. for those who have a hard time distinguishing colors at all). However, adding colors helps as well. Note: sometimes the messages are extremely long, so "ading spaces" could make it even worse :(
|
Thanks for the clarification. I now understand that the coloring proposal is relevant to all output, not just Gradle. I agree that coloring is useful in addition to the row of carets. Both could be implemented using similar logic, I think. I think we would want to enable the coloring with a command-line argument (or query the output to see what kind of terminal it is or whether it's a file) rather than always outputting the color escapes. |
That is true. There might be a default behavior (e.g. enable color if not on Windows, or even disabled by default), and there needs to be a command-line option to disable it. What I think is users might fail to realize there's a color-enabling option, so nobody would notice there's such a feature, so I'm inclined to enable such features by default. I know Gradle does not provide a way to detect if the terminal supports ANSI codes yet (see gradle/gradle#11133 ) |
By the way, Then
could become as follows. The signatures almost match, so printing both in the same line with extra markup for the diffs might work well.
|
Cool. Thanks for the additional details. I agree this would be a useful feature. |
One more sample: interface...
@Nullable T aggregate(Queryable<T> source,
FunctionExpression<Function2<@Nullable T, T, T>> selector); implementation
@Override public T aggregate(
Queryable<T> source,
FunctionExpression<Function2<T, T, T>> selector) {
throw new UnsupportedOperationException();
} error:
|
One more sample:
It looks like In other words:
|
I guess color-coding the error messages would help a lot to understand the failures.
I've implemented a Gradle plugin that color-codes test events from Gradle, and I found "bold", "bold+red foreground", "bold+blue foreground", "black bright foreground" produce good contrast in GitHub Actions (see sample), Travis (see sample), and in my terminal.
Unfortunately, it might be challenging to configure Windows terminals to support colors, so I guess it might need to be disabled by default on Windows. I tried different options to get it working in GitHub Actions+Windows, and it was challenging.
Sample message:
I guess it would help if
@Nullable
and@NonNull
were highlighted.It would help if
@KeyFor("this.getTypes()")
was highlighted.and so on.
WDYT?
The text was updated successfully, but these errors were encountered: