import { Memento , ExtensionContext } from "vscode" ; export let storage ; export const initStorage = ( context ) => { storage = new Storage ( context . globalState ) ; } ; class Storage { private storage : Memento ; constructor ( storageMemento ) { this . storage = storageMemento ; } public keys ( ) { return [ "vscode-taskexplorer" ] ; } public get < T > ( key , defaultValue ? ) { if ( defaultValue ) { let v = this . storage . get < T > ( key , defaultValue ) ; if ( ! v ) { v = defaultValue ; } return v ; } return this . storage . get < T > ( key ) ; } public async update ( key , value ) { await this . storage . update ( key , value ) ; } }