import { WorkspaceConfiguration } from 'vscode' ; import { ExplosionConfig } from '../cursor-exploder/cursor-exploder' ; import { ScreenShakerConfig } from '../screen-shaker/screen-shaker' ; export const CSS_LEFT = "margin-left" ; export const CSS_TOP = "top" ; export interface ThemeConfig extends ExplosionConfig , ScreenShakerConfig { } export interface ExtensionConfig extends ThemeConfig { enabled ? : boolean ; comboThreshold ? : number ; comboTimeout ? : number ; } export function getConfigValue < T > ( key , vscodeConfig , themeConfig ) { if ( isConfigSet ( key , vscodeConfig ) ) { return vscodeConfig . get < T > ( key ) ; } const themeValue = themeConfig [ key ] ; if ( ! isNullOrUndefined ( themeValue ) ) { return themeValue ; } return vscodeConfig . get < T > ( key ) ; } function isNullOrUndefined ( value ) { return value === null || value === undefined ; } function isConfigSet ( key , config ) { const inspectionResults = config . inspect ( key ) ; return ! isNullOrUndefined ( inspectionResults . globalValue ) || ! isNullOrUndefined ( inspectionResults . workspaceValue ) ; }