import { ext , getGlobalSetting , updateGlobalSetting } from "../extension.bundle" ; type SettingValue = { } | string | boolean | undefined ; export async function runWithFuncSetting ( key , value , callback ) { await runWithSettingInternal ( key , value , ext . prefix , callback ) ; } export async function runWithSetting ( key , value , callback ) { await runWithSettingInternal ( key , value , '' , callback ) ; } async function runWithSettingInternal ( key , value , prefix , callback ) { const oldValue = getGlobalSetting ( key , prefix ) ; try { await updateGlobalSetting ( key , value , prefix ) ; await callback ( ) ; } finally { await updateGlobalSetting ( key , oldValue , prefix ) ; } }