Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add formatDiagnostics utility#9689

Merged
mhegazy merged 1 commit into
microsoft:mastermicrosoft/TypeScript:masterfrom
alexeagle:formatDiagsalexeagle/TypeScript:formatDiagsCopy head branch name to clipboard
Jul 13, 2016
Merged

Add formatDiagnostics utility#9689
mhegazy merged 1 commit into
microsoft:mastermicrosoft/TypeScript:masterfrom
alexeagle:formatDiagsalexeagle/TypeScript:formatDiagsCopy head branch name to clipboard

Conversation

@alexeagle

Copy link
Copy Markdown
Contributor

@alexeagle

Copy link
Copy Markdown
Contributor Author

Background: we find that in every program where we type-check, we make a copy of this function to print the diagnostics that several TS apis return.

@alexeagle

Copy link
Copy Markdown
Contributor Author

cc @evmar

@mhegazy

mhegazy commented Jul 13, 2016

Copy link
Copy Markdown
Contributor

thanks!

@mhegazy mhegazy merged commit 049610e into microsoft:master Jul 13, 2016
@mhegazy

mhegazy commented Jul 13, 2016

Copy link
Copy Markdown
Contributor

i am amusing you want this in TS 2.0, if so can you port this to release-2.0 as well. either ways it should be in the nightly today.

@weswigham

Copy link
Copy Markdown
Member

We actually have this function (or one very like it) in a few places inside our test harness, too. We should consolidate.

@evmar

evmar commented Jul 13, 2016

Copy link
Copy Markdown
Contributor

I was saying to Alex that we'd also like to be able to get the pretty
colors/formatting produced by tsc.

On Wed, Jul 13, 2016 at 12:32 PM, Wesley Wigham notifications@github.com
wrote:

We actually have this function (or one very like it) in a few places
inside our test harness, too. We should consolidate.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#9689 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAAPBwJnjb3wuuisw4v80r9C5JMaTlD6ks5qVT1ggaJpZM4JLs6U
.

Comment thread src/compiler/program.ts
}

const category = DiagnosticCategory[diagnostic.category].toLowerCase();
output += `${ category } TS${ diagnostic.code }: ${ flattenDiagnosticMessageText(diagnostic.messageText, sys.newLine) }${ sys.newLine }`;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using sys.newLine is incorrect here since it can be used in environments where sys is not defined. instead it should use host.newLine()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was an existing bug in tsc.ts, then. Other code nearby uses sys as well. But I think your point is that this utility is likely useful in new contexts, not just current usage sites.
I'll send another PR to change it?

@weswigham weswigham Jul 13, 2016

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tsc.ts is only ever used in environments where sys is defined (since it is the command line entry point for node's tsc.js and chakrahost's tsc.exe). utilities, however, is not.

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.