(textDocument: AlphaTexTextDocument)
| 100 | } |
| 101 | |
| 102 | async function validateTextDocument(textDocument: AlphaTexTextDocument): Promise<Diagnostic[]> { |
| 103 | const diagnostics: Diagnostic[] = []; |
| 104 | const text = textDocument.getText(); |
| 105 | |
| 106 | const importer = new alphaTab.importer.AlphaTexImporter(); |
| 107 | importer.initFromString(text, new alphaTab.Settings()); |
| 108 | importer.parser!.mode = alphaTab.importer.alphaTex.AlphaTexParseMode.Full; |
| 109 | try { |
| 110 | textDocument.score = importer.readScore(); |
| 111 | textDocument.ast = importer.scoreNode; |
| 112 | diagnostics.push(...mapDiagnostics(importer.lexerDiagnostics)); |
| 113 | diagnostics.push(...mapDiagnostics(importer.parserDiagnostics)); |
| 114 | diagnostics.push(...mapDiagnostics(importer.semanticDiagnostics)); |
| 115 | } catch (e) { |
| 116 | textDocument.score = undefined; |
| 117 | textDocument.ast = importer.scoreNode; |
| 118 | |
| 119 | diagnostics.push(...handleError(e as Error)); |
| 120 | } |
| 121 | return diagnostics; |
| 122 | } |
no test coverage detected