import { worker } from 'monaco-editor' ; export abstract class BaseSQLWorker { protected abstract _ctx : worker . IWorkerContext ; protected abstract parser : any ; async doValidation ( code ) { code = code || this . getTextDocument ( ) ; if ( code ) { const result = this . parser . validate ( code ) ; return Promise . resolve ( result ) ; } return Promise . resolve ( [ ] ) ; } async valid ( code ) { if ( code ) { const result = this . parser . validate ( code ) ; return Promise . resolve ( result ) ; } return Promise . resolve ( [ ] ) ; } async parserTreeToString ( code ) { if ( code ) { const result = this . parser . parserTreeToString ( code ) ; return Promise . resolve ( result ) ; } return Promise . resolve ( [ ] ) ; } private getTextDocument ( ) { const model = this . _ctx . getMirrorModels ( ) [ 0 ] ; return model && model . getValue ( ) ; } }