import { ConfigurationTarget , Uri , workspace , WorkspaceConfiguration } from "vscode" ; import { extensionPrefix } from "../constants" ; export function getGlobalSetting < T > ( key , prefix = extensionPrefix ) { const projectConfiguration = workspace . getConfiguration ( prefix ) ; const result = projectConfiguration . inspect < T > ( key ) ; return result && result . globalValue ; } export async function updateGlobalSetting < T = string > ( section , value , prefix = extensionPrefix ) { const projectConfiguration = workspace . getConfiguration ( prefix ) ; await projectConfiguration . update ( section , value , ConfigurationTarget . Global ) ; } export function getWorkspaceSetting < T > ( key , fsPath ? , prefix = extensionPrefix ) { const projectConfiguration = workspace . getConfiguration ( prefix , fsPath ? Uri . file ( fsPath ) : undefined ) ; return projectConfiguration . get < T > ( key ) ; } export async function updateWorkspaceSetting < T = string > ( section , value , fsPath , prefix = extensionPrefix ) { const projectConfiguration = workspace . getConfiguration ( prefix , Uri . file ( fsPath ) ) ; await projectConfiguration . update ( section , value ) ; }