Skip to content
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

Improve suggestion text clarity when printing ErrorWithSuggestion #4589

Open
JeffreyCA opened this issue Nov 25, 2024 · 3 comments
Open

Improve suggestion text clarity when printing ErrorWithSuggestion #4589

JeffreyCA opened this issue Nov 25, 2024 · 3 comments

Comments

@JeffreyCA
Copy link
Contributor

JeffreyCA commented Nov 25, 2024

Originally posted by @ellismg in #4585 (comment):

One of the things that jumped out at me with them (which I don't think is a problem introduced by this PR) is that the suggestion text is sort of hard to find, especially with the large amount of red text before.

In a future PR we might want to introduce some whitespace (and maybe some color?) to help it pop a little more - just my two cents.

The place where this happens is in:

if errors.As(err, &suggestionErr) {
m.console.Message(ctx, suggestionErr.Suggestion)
}

I think to customize this we could use one of the pre-defined text formats in colors.go or possibly define a new format for error suggestions:

Current

Image

With newline

Image

Bold

Image

Italics

Image

Underline

Image

Warning

Image

@JeffreyCA
Copy link
Contributor Author

@SophCarp @ccbarragan I don't think this is high priority, but wanted to get your thoughts on how we could improve the clarity here. I included screenshots of some styling options we could explore (not an exhaustive list).

@ccbarragan
Copy link
Member

@JeffreyCA YES, love these explorations.

Should definitely add the new line after the error for better readability. As for the suggestion, IMO would be nice for suggestions to take the same styling as the existing Hint pattern as those two are similar -- will defer to @SophCarp on that one.

@JeffreyCA
Copy link
Contributor Author

@JeffreyCA YES, love these explorations.

Should definitely add the new line after the error for better readability. As for the suggestion, IMO would be nice for suggestions to take the same styling as the existing Hint pattern as those two are similar -- will defer to @SophCarp on that one.

Do you mind sharing what that Hint pattern looks like, and what scenarios it shows up in?

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

No branches or pull requests

2 participants