本文整理汇总了TypeScript中vscode-languageserver-types.Diagnostic.create方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Diagnostic.create方法的具体用法?TypeScript Diagnostic.create怎么用?TypeScript Diagnostic.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vscode-languageserver-types.Diagnostic
的用法示例。
在下文中一共展示了Diagnostic.create方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test('Diagnostic', () => {
let diagnostic = Diagnostic.create(Range.create(1,2,8,9), 'message', DiagnosticSeverity.Warning, 99, 'source');
ok(Range.is(diagnostic.range));
strictEqual(diagnostic.message, 'message');
strictEqual(diagnostic.severity, DiagnosticSeverity.Warning);
strictEqual(diagnostic.code, 99);
strictEqual(diagnostic.source, 'source');
});
示例2: createDiagnosis
function createDiagnosis(range: Range, message: string, source: string = 'stylable', code?: string): Diagnostic {
return Diagnostic.create(range, message, 2, code, source);
}
示例3: reportToDiagnostic
// stylable diagnostic to protocol diagnostic
function reportToDiagnostic(report: StylableDiagnostic) {
const severity = report.type === 'error' ? 1 : 2;
const range = createRange(report);
return Diagnostic.create(range, report.message, severity);
}
示例4: createDiagnostic
function createDiagnostic(msg: string, range?: Range, severity?: DiagnosticSeverity): Diagnostic {
range = range ? range : Range.create(0, 0, 0, 1)
return Diagnostic.create(range, msg, severity || DiagnosticSeverity.Error)
}
示例5: createDiagnostic
function createDiagnostic(msg: string, range?: Range): Diagnostic {
range = range ? range : Range.create(0, 0, 0, 1)
return Diagnostic.create(range, msg)
}