MCPcopy Create free account
hub / github.com/CoderLine/alphaTab / mapDiagnostics

Function mapDiagnostics

packages/lsp/src/server/diagnostics.ts:34–67  ·  view source on GitHub ↗
(atDiag: Iterable<alphaTab.importer.alphaTex.AlphaTexDiagnostic>)

Source from the content-addressed store, hash-verified

32}
33
34function mapDiagnostics(atDiag: Iterable<alphaTab.importer.alphaTex.AlphaTexDiagnostic>): Diagnostic[] {
35 const diagnostics: Diagnostic[] = [];
36 for (const d of atDiag) {
37 const diagnostic: Diagnostic = {
38 severity: DiagnosticSeverity.Warning,
39 range: {
40 start: {
41 line: d.start!.line - 1,
42 character: d.start!.col - 1
43 },
44 end: {
45 line: d.end!.line - 1,
46 character: d.end!.col - 1
47 }
48 },
49 message: d.message,
50 code: `AT${d.code}`,
51 source: 'alphaTab'
52 };
53 switch (d.severity) {
54 case alphaTab.importer.alphaTex.AlphaTexDiagnosticsSeverity.Hint:
55 diagnostic.severity = DiagnosticSeverity.Hint;
56 break;
57 case alphaTab.importer.alphaTex.AlphaTexDiagnosticsSeverity.Warning:
58 diagnostic.severity = DiagnosticSeverity.Warning;
59 break;
60 case alphaTab.importer.alphaTex.AlphaTexDiagnosticsSeverity.Error:
61 diagnostic.severity = DiagnosticSeverity.Error;
62 break;
63 }
64 diagnostics.push(diagnostic);
65 }
66 return diagnostics;
67}
68function handleError(e: Error): Diagnostic[] {
69 let atError: alphaTab.importer.AlphaTexErrorWithDiagnostics | undefined;
70 if (e instanceof alphaTab.importer.AlphaTexErrorWithDiagnostics) {

Callers 2

handleErrorFunction · 0.85
validateTextDocumentFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected