Skip to content

Commit

Permalink
add action to open extensions folder
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero committed Sep 3, 2016
1 parent 6dff3f6 commit 94f66ba
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { IEditorRegistry, Extensions as EditorExtensions } from 'vs/workbench/co
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { VIEWLET_ID, IExtensionsWorkbenchService } from './extensions';
import { ExtensionsWorkbenchService } from './extensionsWorkbenchService';
import { OpenExtensionsViewletAction, InstallExtensionsAction, ShowOutdatedExtensionsAction, ShowRecommendedExtensionsAction, ShowPopularExtensionsAction, ShowInstalledExtensionsAction, UpdateAllAction } from './extensionsActions';
import { OpenExtensionsViewletAction, InstallExtensionsAction, ShowOutdatedExtensionsAction, ShowRecommendedExtensionsAction, ShowPopularExtensionsAction, ShowInstalledExtensionsAction, UpdateAllAction, OpenExtensionsFolderAction } from './extensionsActions';
import { ExtensionsInput } from './extensionsInput';
import { ViewletRegistry, Extensions as ViewletExtensions, ViewletDescriptor } from 'vs/workbench/browser/viewlet';
import { ExtensionEditor } from './extensionEditor';
Expand Down Expand Up @@ -112,6 +112,9 @@ actionRegistry.registerWorkbenchAction(installedActionDescriptor, `Extensions: $
const updateAllActionDescriptor = new SyncActionDescriptor(UpdateAllAction, UpdateAllAction.ID, UpdateAllAction.LABEL);
actionRegistry.registerWorkbenchAction(updateAllActionDescriptor, `Extensions: ${ UpdateAllAction.LABEL }`, ExtensionsLabel);

const openExtensionsFolderActionDescriptor = new SyncActionDescriptor(OpenExtensionsFolderAction, OpenExtensionsFolderAction.ID, OpenExtensionsFolderAction.LABEL);
actionRegistry.registerWorkbenchAction(openExtensionsFolderActionDescriptor, `Extensions: ${ OpenExtensionsFolderAction.LABEL }`, ExtensionsLabel);

Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
.registerConfiguration({
id: 'extensions',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@ import { localize } from 'vs/nls';
import { TPromise } from 'vs/base/common/winjs.base';
import { Action } from 'vs/base/common/actions';
import severity from 'vs/base/common/severity';
import paths = require('vs/base/common/paths');
import Event from 'vs/base/common/event';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { ReloadWindowAction } from 'vs/workbench/electron-browser/actions';
import { IExtension, ExtensionState, IExtensionsWorkbenchService, VIEWLET_ID, IExtensionsViewlet } from './extensions';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IMessageService, LaterAction } from 'vs/platform/message/common/message';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { ToggleViewletAction } from 'vs/workbench/browser/viewlet';
import { IViewletService } from 'vs/workbench/services/viewlet/common/viewletService';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { Query } from '../common/extensionQuery';
import { shell } from 'electron';

export class InstallAction extends Action {

Expand Down Expand Up @@ -494,6 +497,31 @@ export class ChangeSortAction extends Action {
});
}

protected isEnabled(): boolean {
return true;
}
}

export class OpenExtensionsFolderAction extends Action {

static ID = 'workbench.extensions.action.openExtensionsFolder';
static LABEL = localize('openExtensionsFolder', "Open Extensions Folder");

constructor(
id: string,
label: string,
@IEnvironmentService private environmentService: IEnvironmentService
) {
super(id, label, null, true);
}

run(): TPromise<any> {
const extensionsHome = this.environmentService.extensionsPath;
shell.showItemInFolder(paths.normalize(extensionsHome, true));

return TPromise.as(true);
}

protected isEnabled(): boolean {
return true;
}
Expand Down

0 comments on commit 94f66ba

Please sign in to comment.