Return Diagnostic.category from the server

This commit is contained in:
Mohamed Hegazy
2017-04-19 17:12:20 -07:00
parent 6793466cc5
commit 75cdb47cfa
2 changed files with 9 additions and 2 deletions

View File

@@ -1828,6 +1828,11 @@ namespace ts.server.protocol {
* The error code of the diagnostic message.
*/
code?: number;
/**
* The category of the diagnostic message, e.g. "error" vs. "warning"
*/
category: string;
}
export interface DiagnosticEventBody {

View File

@@ -67,7 +67,8 @@ 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()
};
}
@@ -75,7 +76,8 @@ 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()
};
}