'use strict' ; import { Diagnostic , DiagnosticSeverity , Range , Position } from 'vscode' ; import { ProblemInfo , DomainInfo } from 'pddl-workspace' ; export abstract class Validator { constructor ( public path ) { } abstract validate ( domainInfo , problemFiles , onSuccess , onError ) ; createEmptyDiagnostics ( domainInfo , problemFiles ) { const diagnostics = new Map < string , Diagnostic [ ] > ( ) ; diagnostics . set ( domainInfo . fileUri . toString ( ) , [ ] ) ; problemFiles . forEach ( p => diagnostics . set ( p . fileUri . toString ( ) , [ ] ) ) ; return diagnostics ; } static toSeverity ( severity ) { switch ( severity . toLowerCase ( ) ) { case "error" : return DiagnosticSeverity . Error ; case "warning" : return DiagnosticSeverity . Warning ; case "info" : return DiagnosticSeverity . Information ; default : return DiagnosticSeverity . Hint ; } } static createRange ( line , character ) { const position = new Position ( line , character ) ; return new Range ( position , position ) ; } static createLineRange ( line ) { return new Range ( new Position ( line , 0 ) , new Position ( line , Number . MAX_VALUE ) ) ; } }