import * as vscode from "vscode" ; let quickDiagnosticCollection ; let runtimeDiagnosticCollection ; export let diagnostic ; export class Diagnostic { _ctx : vscode . ExtensionContext ; private constructor ( ctx ) { this . _ctx = ctx ; quickDiagnosticCollection = vscode . languages . createDiagnosticCollection ( "ojsQuick" ) ; ctx . subscriptions . push ( quickDiagnosticCollection ) ; runtimeDiagnosticCollection = vscode . languages . createDiagnosticCollection ( "ojsRuntime" ) ; ctx . subscriptions . push ( runtimeDiagnosticCollection ) ; } static attach ( ctx ) { if ( ! diagnostic ) { diagnostic = new Diagnostic ( ctx ) ; } return diagnostic ; } setQuick ( uri , diagnostics ) { quickDiagnosticCollection . set ( uri , diagnostics ) ; } posStr ( r ) { return `${ r . line }_${ r . character }` ; } rangeStr ( r ) { return `${ this . posStr ( r . start ) }->${ this . posStr ( r . end ) }` ; } setRuntime ( uri , diagnostics ) { runtimeDiagnosticCollection . set ( uri , diagnostics ) ; } }