Skip to content
This repository has been archived by the owner on Dec 8, 2020. It is now read-only.

Commit

Permalink
Fixed diagnostics (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
KalitaAlexey authored Feb 16, 2017
1 parent 3057889 commit cafec86
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/cargo/diagnostic_parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ export class DiagnosticParser {
message = `${compilerMessage.code.code}: ${message}`;
}

this.addNotesToMessage(message, compilerMessage.children, 1);
if (primarySpan.label) {
message += `\n label: ${primarySpan.label}`;
}

message = this.addNotesToMessage(message, compilerMessage.children, 1);

const diagnostic = new Diagnostic(range, message, this.toSeverity(compilerMessage.level));

Expand All @@ -141,10 +145,10 @@ export class DiagnosticParser {
}

private addNotesToMessage(msg: string, children: any[], level: number): string {
const ident = ' '.repeat(level);
const indentation = ' '.repeat(level);

for (const child of children) {
msg += `\n${ident}${child.message}`;
msg += `\n${indentation}${child.level}: ${child.message}`;

if (child.spans && child.spans.length > 0) {
msg += ': ';
Expand Down

0 comments on commit cafec86

Please sign in to comment.