vsc-material-theme/extensions/material.theme.config.ts
Alessio Occhipinti d9ea7c2ea6 Feat/release note webview (#248)
* chore(deps): update dependencies

* chore: renamed custom-settings interface

* WIP: added new Webview handler main class

* WIP: added support for Settings webview

* WIP (webview): added gulp command for copying ui files

* WIP (preview): scripts for building updated

* chore: gitignore

* chore: switched to babel-preset-env and added browserify for bundling

* chore: small changes to webviews (added external interfaces file)

* chore: added new task on task explorer and small fix copy ui task

* WIP: webview HTML, JS and CSS added and ready to be developed

* chore: Test native elements

* chore(release): 2.3.0

* chore: init added release notes webview

* chore: Removed unused import

* chore: fixed build release-notes

* chore: Add release notes template

* chore: Update release notes

* chore: Update release notes template

* chore: Update release notes style

* Create stale.yml

* chore: Update release notes

* chore: Removed show-changelog command
2018-08-29 21:30:40 +02:00

52 lines
2 KiB
TypeScript

import {
workspace as Workspace,
commands as Commands,
ExtensionContext
} from 'vscode';
import * as ThemeCommands from './commands';
import {setCustomSetting} from './helpers/settings';
import {onChangeConfiguration} from './helpers/configuration-change';
import {changelogMessage, installationMessage} from './helpers/messages';
import checkInstallation from './helpers/check-installation';
import writeChangelog from './helpers/write-changelog';
import {ReleaseNotesWebview} from '../src/webviews/ReleaseNotes';
import handleAutoapply from './helpers/handle-autoapply';
export async function activate(context: ExtensionContext) {
const config = Workspace.getConfiguration();
const installationType = checkInstallation();
const releaseNotesView = new ReleaseNotesWebview(context);
writeChangelog();
// Listen on set theme: when the theme is Material Theme, just adjust icon and accent.
Workspace.onDidChangeConfiguration(onChangeConfiguration);
// Delete old configuration, must remove with next major release
if (config.has('materialTheme.cache.workbench')) {
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) {
releaseNotesView.show();
}
// Registering commands
Commands.registerCommand('materialTheme.setAccent', async () => {
const wasSet = await ThemeCommands.accentsSetter();
handleAutoapply(wasSet);
});
Commands.registerCommand('materialTheme.fixIcons', () => ThemeCommands.fixIcons());
Commands.registerCommand('materialTheme.toggleApplyIcons', () => ThemeCommands.toggleApplyIcons());
Commands.registerCommand('materialTheme.showReleaseNotes', () => releaseNotesView.show());
}