import { commands , Disposable , ExtensionContext } from "vscode" ; class ContextManager implements Disposable { private _context : ExtensionContext ; private _contextValueMap : Map < string , any > ; public initialize ( context ) { this . _context = context ; this . _contextValueMap = new Map < string , any > ( ) ; } public get context ( ) : ExtensionContext { return this . _context ; } public async setContextValue ( key , value ) { this . _contextValueMap . set ( key , value ) ; await commands . executeCommand ( "setContext" , key , value ) ; } public getContextValue < T > ( key ) { return < T > this . _contextValueMap . get ( key ) ; } public dispose ( ) { this . _contextValueMap . clear ( ) ; } } export const contextManager = new ContextManager ( ) ;