interface IProblem { lineNumber : number ; severity : string ; message : string ; code : string ; source : string ; } export class ProblemManager { private editor : monaco . editor . IStandaloneCodeEditor ; constructor ( editor ) { this . editor = editor ; } public dispose ( ) { this . editor = null ; } set problems ( problems ) { const model = this . editor . getModel ( ) ; let data = [ ] ; problems . forEach ( problem => { let severity ; switch ( problem . severity ) { case "Hint" : severity = monaco . MarkerSeverity . Hint ; break ; case "Info" : severity = monaco . MarkerSeverity . Info ; break ; case "Warning" : severity = monaco . MarkerSeverity . Warning ; break ; case "Error" : severity = monaco . MarkerSeverity . Error ; break ; default : severity = monaco . MarkerSeverity . Error ; } data . push ( < monaco . editor . IMarkerData > { startLineNumber : problem . lineNumber , startColumn : model . getLineFirstNonWhitespaceColumn ( problem . lineNumber ) , endLineNumber : problem . lineNumber , endColumn : model . getLineLastNonWhitespaceColumn ( problem . lineNumber ) , message : problem . message , severity : severity , code : problem . code , source : problem . source } ) ; } ) ; monaco . editor . setModelMarkers ( model , "problems" , data ) ; } }