mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 10:38:59 +01:00
Add in experimental support for js/ts multi-line diagnostics
From da48d42acc
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
* https://github.com/Microsoft/TypeScript-Sublime-Plugin/blob/master/TypeScript%20Indent.tmPreferences
|
||||
* ------------------------------------------------------------------------------------------ */
|
||||
|
||||
import { workspace, Memento, Diagnostic, Range, Disposable, Uri, DiagnosticSeverity, DiagnosticTag } from 'vscode';
|
||||
import { workspace, Memento, Diagnostic, Range, Disposable, Uri, DiagnosticSeverity, DiagnosticTag, DiagnosticRelatedInformation } from 'vscode';
|
||||
|
||||
import * as Proto from './protocol';
|
||||
import * as PConst from './protocol.const';
|
||||
@@ -281,6 +281,17 @@ export default class TypeScriptServiceClientHost {
|
||||
if (diagnostic.code) {
|
||||
converted.code = diagnostic.code;
|
||||
}
|
||||
// TODO: requires TS 3.0
|
||||
const relatedInformation = (diagnostic as any).relatedInformation;
|
||||
if (relatedInformation) {
|
||||
converted.relatedInformation = relatedInformation.map((info: any) => {
|
||||
let span = info.span;
|
||||
if (!span) {
|
||||
return undefined;
|
||||
}
|
||||
return new DiagnosticRelatedInformation(typeConverters.Location.fromTextSpan(this.client.toResource(span.file), span), info.message);
|
||||
}).filter((x: any) => !!x) as DiagnosticRelatedInformation[];
|
||||
}
|
||||
if (diagnostic.reportsUnnecessary) {
|
||||
converted.customTags = [DiagnosticTag.Unnecessary];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user