- Notifications
You must be signed in to change notification settings - Fork13.2k
Stylize tsc's error messages with color and context#5140
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Conflicts:src/compiler/sys.tssrc/compiler/tsc.ts
Conflicts:src/compiler/diagnosticInformationMap.generated.tssrc/compiler/diagnosticMessages.jsonsrc/compiler/sys.tssrc/compiler/tsc.ts
Conflicts:src/compiler/commandLineParser.ts
myitcv commentedOct 6, 2015
Thanks. This should mean that any tools that consume the output from |
DanielRosenwasser commentedOct 6, 2015
@myitcv this was one of the original concerns I heard a lot of from other members of the team; however, I think it would be a good idea to make it a default option in |
Gaelan commentedOct 6, 2015
One thing I would really appreciate would be some sort of coloring for the "starting incremental recompilation" message, so we can more easily tell which errors are current. |
tinganho commentedOct 7, 2015
Awesome that it shows the line numbers! I would also like the message when overflowed to be tabbed to the starting position. For example, the text part I guess you would add colors on the messages too? |
DanielRosenwasser commentedOct 7, 2015
@tinganho I think terminal size detection/wrapping is better left for a separate issue/PR. |
src/compiler/tsc.ts Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
capture the ellipses in a const, and so is its length.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
also applies to the squiggle down below.
mhegazy commentedNov 2, 2015
LGTM. a few nits, but other than than that 👍 |
mhegazy commentedNov 2, 2015
please add a snippet about it inhttps://github.com/Microsoft/TypeScript/wiki/What%27s-new-in-TypeScript |
a15c0de to40f10abCompareStylize tsc's error messages with color and context
This change seeks to make our output a little easier on the eyes and addresses#3852. I suggest this PR's final changes be reviewed rather than going commit-by-commit.
Firstly, a new flag is introduced:
--diagnosticStyle. It accepts the optionsprettyandsimple. It is currently marked as experimental, and we can bikeshed over the names later.If
--diagnosticStyle simpleis used, the user will get the same behavior as they experience today.Note thatsimpleis left as the default.If
--diagnosticStyle prettyis used as an option, then we check if we are outputting to a terminal-style descriptor. If we areentirely sure, then we stylize the output with color. If not (e.g. output is being piped, forwarded to a file, etc.) we make the output readable so that no special control characters are used in the output.Here's some screenshots/gifs to give you an idea of what this looks like right now.
Monokai

Solarized Light

Terminal Basic

My Stupid Terminal Theme

Cygwin's MinTTY

cmd.exe

GNOME Terminal Defaults in Ubuntu
