import * as monaco from 'monaco-editor/esm/vs/editor/editor.api' ; import { createParser , Parser , ParseResult } from '../grammar' ; export class XJsonWorker { constructor ( private ctx ) { } private parser : Parser | undefined ; async parse ( modelUri ) { if ( ! this . parser ) { this . parser = createParser ( ) ; } const model = this . ctx . getMirrorModels ( ) . find ( ( m ) => m . uri . toString ( ) === modelUri ) ; if ( model ) { return this . parser ( model . getValue ( ) ) ; } } }