import * as vscode from "vscode" ; import { resolveClassFilters } from "./languageServerPlugin" ; export async function populateStepFilters ( config ) { if ( ! config . stepFilters ) { return ; } const skipClasses = await substituteFilterVariables ( config . stepFilters . skipClasses ) ; if ( Array . isArray ( config . stepFilters . classNameFilters ) ) { mergeResult ( config . stepFilters . classNameFilters , skipClasses ) ; } config . stepFilters . classNameFilters = undefined ; config . stepFilters . skipClasses = skipClasses ; } export async function substituteFilterVariables ( skipClasses ) { if ( ! skipClasses ) { return [ ] ; } try { if ( Array . isArray ( skipClasses ) ) { const hasReservedName = skipClasses . some ( ( filter ) => filter === "$JDK" || filter === "$Libraries" ) ; return hasReservedName ? await resolveClassFilters ( skipClasses ) : skipClasses ; } else { console . error ( "Invalid type for skipClasses config:" + skipClasses ) ; } } catch ( e ) { console . error ( e ) ; } return [ ] ; } function mergeResult ( newItems , result ) { newItems . forEach ( ( item ) => { if ( result . indexOf ( item ) < 0 ) { result . push ( String ( item ) ) ; } } ) ; }