vsc-material-theme/extensions/helpers/vscode.ts
Mattia Astorino 9907cc8c67
Develop (#185)
* chore: Update meta and readme

* chore. Update README

* Refactor/linting - tslint-xo (#178)

* refactor(deps): added tslint, cleanup, and activationEvents modified

* refactor(lint): linting...

* refactor(changelog): changelo method refactor (should be tested)

* refactor(theme-icons):  linting and small refactor

* refactor(accents-setter): linting and small refactor

* chore(travis): added travis file

* fix(Lighter): Fix folders icon association

* chore: Clean test files

* fix(Icons): Add icon to .spec.ts files

* chore: Update git icon

* Update issue templates (#184)
2018-05-07 16:23:17 +02:00

44 lines
1.2 KiB
TypeScript

import * as vscode from 'vscode';
export function askForWindowReload(): Thenable<void> {
const PROMPT_MESSAGE: string = 'Material Theme requires VS Code reload in order to display icons correctly.';
const PROMPT_MESSAGE_CONFIRM: string = 'Ok, reload';
const PROMPT_MESSAGE_CANCEL: string = 'I will do it later';
return vscode.window.showInformationMessage(PROMPT_MESSAGE, PROMPT_MESSAGE_CONFIRM, PROMPT_MESSAGE_CANCEL)
.then(response => {
if (response === PROMPT_MESSAGE_CONFIRM) {
reloadWindow();
}
}, err => {
console.log(err);
});
}
/**
* Gets your current theme ID
*/
export function getCurrentThemeID(): string {
return vscode.workspace.getConfiguration().get<string>('workbench.colorTheme');
}
/**
* Gets your current icons theme ID
*/
export function getCurrentThemeIconsID(): string {
return vscode.workspace.getConfiguration().get<string>('workbench.iconTheme');
}
/**
* Set a specific id for icons
*/
export function setIconsID(id: string): Thenable<void> {
return vscode.workspace.getConfiguration().update('workbench.iconTheme', id, true);
}
/**
* Reloads current vscode window.
*/
export function reloadWindow(): void {
vscode.commands.executeCommand('workbench.action.reloadWindow');
}