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

Function validateTextDocument

packages/lsp/src/server/diagnostics.ts:102–122  ·  view source on GitHub ↗
(textDocument: AlphaTexTextDocument)

Source from the content-addressed store, hash-verified

100}
101
102async 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}

Callers 1

setupDiagnosticsFunction · 0.85

Calls 5

initFromStringMethod · 0.95
readScoreMethod · 0.95
mapDiagnosticsFunction · 0.85
handleErrorFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected