本文整理匯總了TypeScript中vscode-languageserver-types.Diagnostic類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Diagnostic類的具體用法?TypeScript Diagnostic怎麽用?TypeScript Diagnostic使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Diagnostic類的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)
}