vsc-material-theme/extensions/helpers/configuration-change.ts
Alessio Occhipinti 48c6feaf75 Ux/reload notification (#232)
* chore: check on installation type now as single module

* feat(Reload notification): added support for after-install notification

* feat(Reload notification): added support never show again notification
2018-08-12 19:09:36 +02:00

30 lines
973 B
TypeScript

import {
ConfigurationChangeEvent
} from 'vscode';
import {getCustomSettings, isMaterialThemeIcons, isMaterialTheme} from './settings';
import {getCurrentThemeIconsID, getCurrentThemeID} from './vscode';
import handleAutoapply from './handle-autoapply';
const onIconsChanged = () => {
const customSettings = getCustomSettings();
if (customSettings.fixIconsRunning) {
return;
}
const currentIconsTheme = getCurrentThemeIconsID();
return handleAutoapply(isMaterialThemeIcons(currentIconsTheme));
};
const onThemeChanged = () => {
const currentTheme = getCurrentThemeID();
return handleAutoapply(isMaterialTheme(currentTheme));
};
export const onChangeConfiguration = (event: ConfigurationChangeEvent) => {
const isColorTheme = event.affectsConfiguration('workbench.colorTheme');
const isIconTheme = event.affectsConfiguration('workbench.iconTheme');
return isIconTheme ? onIconsChanged() :
isColorTheme ? onThemeChanged() : null;
};