提交 26d5d76a 编写于 作者: M Matt Bierner

Add in experimental support for js/ts multi-line diagnostics

From https://github.com/weswigham/vscode/commit/da48d42acc7b4be254d644b8d894e20608fa3ee3
上级 43f6cd5b
......@@ -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];
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册