Merge remote-tracking branch 'origin/master' into release-2.3

This commit is contained in:
Mohamed Hegazy
2017-04-20 14:21:04 -07:00
3 changed files with 18 additions and 2 deletions

View File

@@ -3350,6 +3350,7 @@ namespace ts {
messageText: string | DiagnosticMessageChain;
category: DiagnosticCategory;
code: number;
source?: string;
}
export enum DiagnosticCategory {

View File

@@ -1824,10 +1824,20 @@ namespace ts.server.protocol {
*/
text: string;
/**
* The category of the diagnostic message, e.g. "error" vs. "warning"
*/
category: string;
/**
* The error code of the diagnostic message.
*/
code?: number;
/**
* The name of the plugin reporting the message.
*/
source?: string;
}
export interface DiagnosticEventBody {

View File

@@ -78,7 +78,9 @@ namespace ts.server {
start: scriptInfo.positionToLineOffset(diag.start),
end: scriptInfo.positionToLineOffset(diag.start + diag.length),
text: ts.flattenDiagnosticMessageText(diag.messageText, "\n"),
code: diag.code
code: diag.code,
category: DiagnosticCategory[diag.category].toLowerCase(),
source: diag.source
};
}
@@ -86,7 +88,9 @@ namespace ts.server {
return {
start: undefined,
end: undefined,
text: ts.flattenDiagnosticMessageText(diag.messageText, "\n")
text: ts.flattenDiagnosticMessageText(diag.messageText, "\n"),
category: DiagnosticCategory[diag.category].toLowerCase(),
source: diag.source
};
}
@@ -601,6 +605,7 @@ namespace ts.server {
length: d.length,
category: DiagnosticCategory[d.category].toLowerCase(),
code: d.code,
source: d.source,
startLocation: scriptInfo && scriptInfo.positionToLineOffset(d.start),
endLocation: scriptInfo && scriptInfo.positionToLineOffset(d.start + d.length)
});