import * as _ from 'lodash' ; import * as vscode from 'vscode' ; const Config = { get ( extension = 'todo' ) { return vscode . workspace . getConfiguration ( ) . get ( extension ) as any ; } , getKey ( key ) { return _ . get ( Config . get ( ) , key ) as any ; } , check ( config ) { const checkers = [ config => _ . isString ( _ . get ( config , 'file' ) ) && 'Todo+: "todo.file" has been renamed to "todo.file.name"' , config => _ . isString ( _ . get ( config , 'defaultContent' ) ) && 'Todo+: "todo.defaultContent" has been renamed to "todo.file.defaultContent"' , config => _ . isArray ( _ . get ( config , 'tags.backgroundColors' ) ) && 'Todo+: "todo.tags.backgroundColors" has been renamed to "todo.colors.tags.background"' , config => _ . isArray ( _ . get ( config , 'tags.foregroundColors' ) ) && 'Todo+: "todo.tags.foregroundColors" has been renamed to "todo.colors.tags.foreground"' ] ; const errors = _ . compact ( checkers . map ( checker => checker ( config ) ) ) ; if ( ! errors . length ) return ; errors . forEach ( err => vscode . window . showErrorMessage ( err ) ) ; throw new Error ( 'Invalid configuration, check the changelog' ) ; } } ; export default Config ;