diff --git a/extensions/helpers/messages.ts b/extensions/helpers/messages.ts index c68c9d8..a9bfc54 100644 --- a/extensions/helpers/messages.ts +++ b/extensions/helpers/messages.ts @@ -12,14 +12,30 @@ const MESSAGES = { CHANGELOG: { message: 'Material Theme was updated. Check the release notes for more details.', options: {ok: 'Show me', cancel: 'Maybe later'} + }, + INSTALLATION: { + message: 'Thank you for installing Material Theme! Would you like to enable the auto-application (with window reload when needed) of the Material Theme icons?', + options: {ok: 'Sure!', cancel: 'Nope :('} } }; export const infoMessage = async () => { - if (await Window.showInformationMessage(MESSAGES.INFO.message, MESSAGES.INFO.options.ok, MESSAGES.INFO.options.cancel) === MESSAGES.INFO.options.ok) { + if (await Window.showInformationMessage( + MESSAGES.INFO.message, + ...MESSAGES.INFO.options as any + ) === MESSAGES.INFO.options.ok) { ThemeCommands.fixIcons(); } }; export const changelogMessage = async () => - await Window.showInformationMessage(MESSAGES.CHANGELOG.message, MESSAGES.CHANGELOG.options.ok, MESSAGES.CHANGELOG.options.cancel) === MESSAGES.CHANGELOG.options.ok; + await Window.showInformationMessage( + MESSAGES.CHANGELOG.message, + ...MESSAGES.CHANGELOG.options as any + ) === MESSAGES.CHANGELOG.options.ok; + +export const installationMessage = async () => + await Window.showInformationMessage( + MESSAGES.INSTALLATION.message, + ...MESSAGES.INSTALLATION.options as any + ) === MESSAGES.INSTALLATION.options.ok; diff --git a/extensions/material.theme.config.ts b/extensions/material.theme.config.ts index b603979..f13f22d 100644 --- a/extensions/material.theme.config.ts +++ b/extensions/material.theme.config.ts @@ -4,9 +4,9 @@ import { } from 'vscode'; import * as ThemeCommands from './commands'; -import {isAutoApplyEnable} from './helpers/settings'; +import {isAutoApplyEnable, setCustomSetting} from './helpers/settings'; import {onChangeConfiguration} from './helpers/configuration-change'; -import {infoMessage, changelogMessage} from './helpers/messages'; +import {infoMessage, changelogMessage, installationMessage} from './helpers/messages'; import checkInstallation from './helpers/check-installation'; import writeChangelog from './helpers/write-changelog'; @@ -24,6 +24,13 @@ export async function activate() { config.update('materialTheme.cache.workbench', undefined, true); } + if (installationType.isFirstInstall) { + const enableAutoApply = await installationMessage(); + await setCustomSetting('autoApplyIcons', enableAutoApply); + // Set true always on new installation + await setCustomSetting('showReloadNotification', true); + } + const shouldShowChangelog = (installationType.isFirstInstall || installationType.isUpdate) && await changelogMessage(); if (shouldShowChangelog) { ThemeCommands.showChangelog(); diff --git a/package.json b/package.json index 8e58291..9aa89e6 100644 --- a/package.json +++ b/package.json @@ -93,7 +93,12 @@ }, "materialTheme.autoApplyIcons": { "type": "boolean", - "description": "Enable/disable auto-apply of Material Theme icons", + "description": "Enable/disable auto-apply of Material Theme icons with window reload when needed", + "default": false + }, + "materialTheme.showReloadNotification": { + "type": "boolean", + "description": "Useful when autoApplyIcons is false and you want to be asked to reload the window when needed", "default": true }, "materialTheme.fixIconsRunning": {