2018-05-18 13:47:22 +02:00
|
|
|
import {
|
|
|
|
ConfigurationChangeEvent
|
|
|
|
} from 'vscode';
|
2018-08-12 12:48:23 +02:00
|
|
|
import {getCustomSettings, isMaterialThemeIcons, isMaterialTheme} from './settings';
|
2018-05-18 13:47:22 +02:00
|
|
|
import {getCurrentThemeIconsID, getCurrentThemeID} from './vscode';
|
|
|
|
|
2018-08-12 12:48:23 +02:00
|
|
|
import handleAutoapply from './handle-autoapply';
|
2018-05-18 13:47:22 +02:00
|
|
|
|
|
|
|
const onIconsChanged = () => {
|
|
|
|
const customSettings = getCustomSettings();
|
|
|
|
if (customSettings.fixIconsRunning) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const currentIconsTheme = getCurrentThemeIconsID();
|
2018-08-12 12:48:23 +02:00
|
|
|
return handleAutoapply(isMaterialThemeIcons(currentIconsTheme));
|
2018-05-18 13:47:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
const onThemeChanged = () => {
|
|
|
|
const currentTheme = getCurrentThemeID();
|
2018-08-12 12:48:23 +02:00
|
|
|
return handleAutoapply(isMaterialTheme(currentTheme));
|
2018-05-18 13:47:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
export const onChangeConfiguration = (event: ConfigurationChangeEvent) => {
|
|
|
|
const isColorTheme = event.affectsConfiguration('workbench.colorTheme');
|
|
|
|
const isIconTheme = event.affectsConfiguration('workbench.iconTheme');
|
|
|
|
|
2018-08-12 12:48:23 +02:00
|
|
|
return isIconTheme ? onIconsChanged() :
|
|
|
|
isColorTheme ? onThemeChanged() : null;
|
2018-05-18 13:47:22 +02:00
|
|
|
};
|