Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Use Unicode line drawing characters for spans #24387

Closed
kmcallister opened this issue Apr 13, 2015 · 23 comments
Closed

Use Unicode line drawing characters for spans #24387

kmcallister opened this issue Apr 13, 2015 · 23 comments
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR)

Comments

@kmcallister
Copy link
Contributor

example

See discussion on old PR #21406. @Manishearth expressed interest in reviving this.

@kmcallister kmcallister added A-frontend Area: Compiler frontend (errors, parsing and HIR) E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. A-an-interesting-project labels Apr 13, 2015
@sinistersnare
Copy link
Contributor

+1 sounds nice.

Would this work on any windows terminals, such as the shell that comes with mingw?

Oh just read through the thread again, WGL4. cool!

@liigo
Copy link
Contributor

liigo commented Apr 14, 2015 via email

@tbelaire
Copy link
Contributor

The plan, from before was to have both a flag --output-plain-ascii, as well as environment variables which can be set to always, auto or never, for each of color, having underlines at all, and having unicode underlines.

@ftxqxd
Copy link
Contributor

ftxqxd commented Jul 7, 2015

Alternatively, we could use U+203E OVERLINE (, also part of WGL4) to create a simpler underline effect:

U+202E OVERLINE in a warning

This is different from using an ANSI escape code such as \x1b[4m because it allows the underline colour to be different from the text’s colour.

@shinglyu
Copy link

shinglyu commented Jul 7, 2015

I'm a noob, can I give it a try? I could try writing a unicode version, then implement the --output-plain-ascii flag.

@Manishearth
Copy link
Member

@shinglyu sure! You can borrow a lot of stuff from Keegan's impl here, feel free to ask me if you have more questions!

@shinglyu
Copy link

shinglyu commented Jul 7, 2015

@Manishearth : nice to see you again :)

@shinglyu
Copy link

shinglyu commented Jul 8, 2015

@Manishearth : I tried to read the patch #21406, but I had a hard time understanding the codebase. Is there any document/blog post/diagram/etc that explains the folder structure and runtime behavior? Most of the docs I found are explaining the Rust language syntax.

Or should I start by reading the llvm tutorial?

@Manishearth
Copy link
Member

src/librustc/session/config.rs contains the stuff for sorting out command line arguments

src/libsyntax/diagnostic.rs has the stuff for printing out a span.

You don't need to understand the rest at this stage, really :)

@shinglyu
Copy link

@Manishearth : thanks! I'll take a look.

@shinglyu
Copy link

@Manishearth @kmcallister : Changing ascii to UTF-8 is pretty straight forward. But I want to clarify the spec.

From what I understand in the closed PR,

  • We have 3 environment variables for output capability
    • RUSTC_OUTPUT_COLOR = always | auto | never
    • RUSTC_OUTPUT_CURSOR_POS = always | auto | never
    • RUSTC_OUTPUT_UTF8 = always | auto | never
    • If any of the three is un-set or is invalid value, use auto
  • There are 2 way to set the above three as never:
    • --output-plain-ascii flag
    • RUSTC_OUTPUT_PLAIN_ASCII =

I have some questions:

  • If cursor positioning is not enabled, what do we do?
  • What are all those flag stability and warning thing?

Thanks!

@bluss
Copy link
Member

bluss commented Jul 15, 2015

Most programs will check against LC_CTYPE (i.e. the locale's encoding setting) to see what they can emit. If it's not a UTF-8 locale, just emit ascii.

@alexispurslane
Copy link
Contributor

Is this going anywhere?

@alexispurslane
Copy link
Contributor

I like the idea, but Rust still doesn't do this.

@pmatos
Copy link
Contributor

pmatos commented Oct 19, 2015

@shinglyu how is this going?

@shinglyu
Copy link

Sorry I claimed it but didn't finish it on time. Give me one week to work on this. If I can't make it, anyone if free to take it.

@pmatos
Copy link
Contributor

pmatos commented Oct 20, 2015

OK, @shinglyu , if you see you won't make it, can you please post your progress so someone can pick it up where you left off instead of starting from scratch? Thanks!

@pnkfelix
Copy link
Member

Uh @shinglyu @pmatos do note there is #28902

@shinglyu
Copy link

Oh ok, so look like the old PR is being revived. Let's go with #28902 then.

@Manishearth Manishearth added the E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. label Feb 29, 2016
@brson brson added E-help-wanted Call for participation: Help is requested to fix this issue. and removed E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. labels Jun 27, 2016
@brson
Copy link
Contributor

brson commented Jun 27, 2016

With the recent churn in error reporting, this will probably need to start from scratch. Still a cool idea.

@brson
Copy link
Contributor

brson commented Jun 27, 2016

cc @jonathandturner maybe you have ideas about how to beautify new error reporting with unicode.

@sophiajt
Copy link
Contributor

We've got an RFC going here: rust-lang/rfcs#1644

We opted not to use Unicode because we did a look at what was generally available across platforms and Windows doesn't use Unicode by default in the terminal. I know that they're working on a better terminal experience, so things might change there.

@brson brson removed E-help-wanted Call for participation: Help is requested to fix this issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. labels Jun 29, 2016
@steveklabnik
Copy link
Member

The error format RFC ended up explicitly deciding against this: https://github.com/rust-lang/rfcs/blob/master/text/1644-default-and-expanded-rustc-errors.md#format-of-error-messages So I'm going to give it a close.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR)
Projects
None yet
Development

No branches or pull requests