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

Beginning of more beautiful rustc --explain #25033

Closed
wants to merge 4 commits into from

Conversation

Projects
None yet
8 participants
@GuillaumeGomez
Copy link
Member

GuillaumeGomez commented May 1, 2015

As mentionned in #24523, here is the beginning of the more beautiful printing. Only tested under linux. It doesn't -yet- manage terminals which doesn't handle color printing. Any opinion is welcome.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented May 1, 2015

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@GuillaumeGomez GuillaumeGomez changed the title Beginning of beautifuler rustc --explain Beginning of more beautiful rustc --explain May 1, 2015

@GuillaumeGomez GuillaumeGomez force-pushed the GuillaumeGomez:explain branch from 6804393 to 390241e May 1, 2015

GuillaumeGomez added some commits May 1, 2015

@killercup

This comment has been minimized.

Copy link
Member

killercup commented May 2, 2015

This sounds quite cool. Can you maybe add a screenshot?

I guess by only using blue and red for highlights, you don't need to concern yourself with detecting the terminals background color (since red and blue both work on dark and light backgrounds). Do you have any plans for a more complex color scheme?

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented May 2, 2015

I actually asked yesterday on the IRC if there is any color code but no one answered. For the parsing, I wanted to use the one made in rustdoc (I asked for help for that but no answer yet neither ^^). Here is the current display :

screenshot from 2015-05-02 13 00 04

@bluss

This comment has been minimized.

Copy link
Contributor

bluss commented May 2, 2015

Errors and warnings are already colored. Rustc uses som kind of term library for this. You should look into it.

@killercup

This comment has been minimized.

Copy link
Member

killercup commented May 2, 2015

@GuillaumeGomez, @bluss is right, there is a libterm (docs) that seems to do some terminal output stuff.

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented May 2, 2015

Oh nice ! I'll take a look then !

@huonw

This comment has been minimized.

Copy link
Member

huonw commented May 2, 2015

It would be good to have this code not directly inside lib.rs, e.g. a explain.rs submodule would be better.

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented May 2, 2015

@huonw: Don't worry, it was just a start to have an idea of what it'll look like after. For now, the code is just ugly.

@GuillaumeGomez GuillaumeGomez force-pushed the GuillaumeGomez:explain branch from ac17c61 to 02d875d May 2, 2015

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented May 2, 2015

I created an explain.rs submodule and I also use the libterm. But I'm not very happy of the color code. Another one could be nice. Any idea of how I could improve it ?

@ghost

This comment has been minimized.

Copy link

ghost commented May 2, 2015

I'm concerned about the maintainability of this code. Could we use something like https://github.com/rkitover/vimpager or http://www.gnu.org/software/src-highlite/ for this purpose, instead? We have the vim definitions already so this would be a matter of shelling out, of course conditional on vim being present.

The build changes may be non-trivial but would be more future-proof, I think. Thoughts?

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented May 2, 2015

I'm a fan of emacs actually. :-p Once again, this code is just a preview, I don't intend to continue this one. I'd prefer use something from inside the compiler (I'm thinking about the librustdoc).

@michaelsproul

This comment has been minimized.

Copy link
Contributor

michaelsproul commented May 4, 2015

One way I thought of doing this would be to write a custom renderer for Hoedown (the markdown parser used by rustdoc). This would give us heading highlighting almost for free, and then we could generalise the code in src/librustdoc/html/higlight.rs to highlight code blocks.

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented May 4, 2015

@michaelsproul: hum... Why not. Originally, I was going to use the rustdoc, not modify it. However it seems even better this way, I'll give it a try.

@michaelsproul

This comment has been minimized.

Copy link
Contributor

michaelsproul commented May 4, 2015

@GuillaumeGomez: It's a whole lot of FFI and stuff, but if you're up for it...

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented May 4, 2015

I am. I'll start to see how rustdoc works before going any further and then I'll modify it.

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented May 21, 2015

@GuillaumeGomez So I am confused as to what should happen with this current PR -- should we close it, as you are now trying an alternative approach?

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented May 21, 2015

I'm still working on rustdoc. I don't have much time recently (and I'm sorry about that). So can you keep it open while I start the other one please ?

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Jul 5, 2015

Closing due to inactivity, but I'm looking forward to see where this goes!

@GuillaumeGomez GuillaumeGomez deleted the GuillaumeGomez:explain branch Jul 8, 2015

@GuillaumeGomez GuillaumeGomez referenced this pull request Apr 27, 2016

Closed

Error Message Overhaul #33240

1 of 10 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.