[GHC] #13444: Disable diagnostic coloring by default

`-fdiagnostics-color[=WHEN]` `-fno-diagnostics-color`
Use color in diagnostics. WHEN is never, always, or auto. The default depends on how the compiler has been configured, it can be any of the above WHEN
#13444: Disable diagnostic coloring by default -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Incorrect Unknown/Multiple | error/warning at compile-time Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- TO my suprise, GHC 8.2.1 enables colors by default which is rather annoying to me as it looks rather ugly with my terminal coloring scheme. This should follow GCC's model instead which defaults them off and allows to customize the coloring scheme via `GCC_COLORS`. Quoting the GCC man- page: options or also never
if GCC_COLORS environment variable isn't present in the environment,
and auto
otherwise. auto means to use color only when the standard error is
a terminal. The
forms -fdiagnostics-color and -fno-diagnostics-color are aliases for `-fdiagnostics-color=always` and `-fdiagnostics-color=never`,
respectively.
The colors are defined by the environment variable `GCC_COLORS`.
Its value is a colon-
separated list of capabilities and Select Graphic Rendition (SGR)
substrings. SGR
commands are interpreted by the terminal or terminal emulator. (See
the section in the
documentation of your text terminal for permitted values and their
meanings as
character attributes.) These substring values are integers in
decimal representation
and can be concatenated with semicolons. Common values to
concatenate include 1 for
bold, 4 for underline, 5 for blink, 7 for inverse, 39 for default
foreground color, 30
to 37 for foreground colors, 90 to 97 for 16-color mode foreground
colors, 38;5;0 to
38;5;255 for 88-color and 256-color modes foreground colors, 49 for
default background
color, 40 to 47 for background colors, 100 to 107 for 16-color mode
background colors,
and 48;5;0 to 48;5;255 for 88-color and 256-color modes background
colors.
The default `GCC_COLORS` is
`error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01`
where 01;31 is bold red, 01;35 is bold magenta, 01;36 is bold cyan,
01;32 is bold green
and 01 is bold. Setting GCC_COLORS to the empty string disables
colors. Supported
capabilities are as follows.
"error=" SGR substring for error: markers.
"warning=" SGR substring for warning: markers.
"note=" SGR substring for note: markers.
"caret=" SGR substring for caret line.
"locus=" SGR substring for location information, file:line or
file:line:column etc.
"quote=" SGR substring for information printed within quotes.
-- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13444 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13444: Disable diagnostic coloring by default -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple error/warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by hvr): Quoting also https://gcc.gnu.org/gcc-4.9/changes.html when this was introduced to GCC:
Support for colorizing diagnostics emitted by GCC has been added. The `-fdiagnostics-color=auto` will enable it when outputting to terminals, `-fdiagnostics-color=always` unconditionally. The `GCC_COLORS` environment variable can be used to customize the colors or disable coloring. **If `GCC_COLORS` variable is present in the environment, the default is `-fdiagnostics-color=auto`, otherwise `-fdiagnostics-color=never`.**
-- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13444#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13444: Disable diagnostic coloring by default -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple error/warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * cc: Rufflewind (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13444#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13444: Disable diagnostic coloring by default -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple error/warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by dfeuer): I'd prefer to make the default `auto`. To be frank, looking pretty in your coloring scheme seems less important than helping new users understand what's going on. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13444#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13444: Disable diagnostic coloring by default -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple error/warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): I do agree that the ability to configure the color scheme with a `GHC_COLORS` environment variable would be a cool feature. But I agree with David that I think outright disabling colors unless an environment variable is defined is going too far. Moreover, you can disable colors quite easily with `-fdiagnostics-color=never` in GHC, so I don't think this needs to be a release blocker. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13444#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13444: Disable diagnostic coloring by default -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple error/warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Rufflewind): Any specific suggestions on how the default color scheme could be tuned to be more aesthetically pleasing? I think red is pretty standard for errors, but the colors of warnings and margins could perhaps be tweaked if needed. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13444#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13444: Disable diagnostic coloring by default -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple error/warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): D3364 Wiki Page: | -------------------------------------+------------------------------------- Changes (by Rufflewind): * differential: => D3364 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13444#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13444: Disable diagnostic coloring by default -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple error/warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3364 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * differential: D3364 => Phab:D3364 Comment: Impressive turnaround time, Rufflewind! Many thanks for your continued work on this effort. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13444#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13444: Disable diagnostic coloring by default -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple error/warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3364 Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): Merged to GHC 8.2 with 7141a183a968b3418c113b234de9f75a0a735766. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13444#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13444: Disable diagnostic coloring by default -------------------------------------+------------------------------------- Reporter: hvr | Owner: (none) Type: bug | Status: closed Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple error/warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3364 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => closed * resolution: => fixed Comment: And to master with adf27d614f8a48d8dcf2d4e2e7872f7b3f818364. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13444#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC