import { languages , Diagnostic , Range , DiagnosticSeverity , Uri } from 'vscode' ; export default class EchartsDiagnostic { #diagnosticCollection = languages . createDiagnosticCollection ( 'echarts' ) ; #diagnostics : Diagnostic [ ] = [ ] ; #uri : Uri ; constructor ( uri ) { this . #uri = uri ; } clearDiagnostics ( ) { this . #diagnostics = [ ] ; this . #diagnosticCollection . clear ( ) ; } changeActiveEditor ( uri ) { this . #uri = uri ; } createDiagnostic ( range , message = 'warning' , severity = DiagnosticSeverity . Warning ) { this . #diagnostics . push ( new Diagnostic ( range , message , severity ) ) ; } showError ( ) { this . #diagnosticCollection . clear ( ) ; this . #diagnosticCollection . set ( this . #uri , this . #diagnostics ) ; } }