Skip to content

Commit 15f3444

Browse files
authored
polish import/export (microsoft#166703)
1 parent 4070575 commit 15f3444

File tree

5 files changed

+160
-118
lines changed

5 files changed

+160
-118
lines changed

src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,24 +261,24 @@ const jsonRegistry = <jsonContributionRegistry.IJSONContributionRegistry>Registr
261261
jsonRegistry.registerSchema(ExtensionsConfigurationSchemaId, ExtensionsConfigurationSchema);
262262

263263
// Register Commands
264-
CommandsRegistry.registerCommand('_extensions.manage', (accessor: ServicesAccessor, extensionId: string, tab?: ExtensionEditorTab) => {
264+
CommandsRegistry.registerCommand('_extensions.manage', (accessor: ServicesAccessor, extensionId: string, tab?: ExtensionEditorTab, preserveFocus?: boolean) => {
265265
const extensionService = accessor.get(IExtensionsWorkbenchService);
266266
const extension = extensionService.local.filter(e => areSameExtensions(e.identifier, { id: extensionId }));
267267
if (extension.length === 1) {
268-
extensionService.open(extension[0], { tab });
268+
extensionService.open(extension[0], { tab, preserveFocus });
269269
}
270270
});
271271

272-
CommandsRegistry.registerCommand('extension.open', async (accessor: ServicesAccessor, extensionId: string, tab?: ExtensionEditorTab) => {
272+
CommandsRegistry.registerCommand('extension.open', async (accessor: ServicesAccessor, extensionId: string, tab?: ExtensionEditorTab, preserveFocus?: boolean) => {
273273
const extensionService = accessor.get(IExtensionsWorkbenchService);
274274
const commandService = accessor.get(ICommandService);
275275

276276
const [extension] = await extensionService.getExtensions([{ id: extensionId }], CancellationToken.None);
277277
if (extension) {
278-
return extensionService.open(extension, { tab });
278+
return extensionService.open(extension, { tab, preserveFocus });
279279
}
280280

281-
return commandService.executeCommand('_extensions.manage', extensionId, tab);
281+
return commandService.executeCommand('_extensions.manage', extensionId, tab, preserveFocus);
282282
});
283283

284284
CommandsRegistry.registerCommand({

src/vs/workbench/services/userDataProfile/browser/extensionsResource.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ export class ExtensionsResourceExportTreeItem implements IProfileResourceTreeIte
176176
command: {
177177
id: 'extension.open',
178178
title: '',
179-
arguments: [e.identifier.id]
179+
arguments: [e.identifier.id, undefined, true]
180180
}
181181
}));
182182
}
@@ -214,11 +214,16 @@ export class ExtensionsResourceImportTreeItem implements IProfileResourceTreeIte
214214
command: {
215215
id: 'extension.open',
216216
title: '',
217-
arguments: [e.identifier.id]
217+
arguments: [e.identifier.id, undefined, true]
218218
}
219219
}));
220220
}
221221

222+
async hasContent(): Promise<boolean> {
223+
const extensions = await this.instantiationService.createInstance(ExtensionsResource).getProfileExtensions(this.content);
224+
return extensions.length > 0;
225+
}
226+
222227
}
223228

224229

src/vs/workbench/services/userDataProfile/browser/globalStateResource.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,15 @@ export class GlobalStateResourceExportTreeItem implements IProfileResourceTreeIt
7777
readonly label = { label: localize('globalState', "UI State") };
7878
readonly collapsibleState = TreeItemCollapsibleState.None;
7979
checkbox: ITreeItemCheckboxState = { isChecked: true };
80+
readonly command = {
81+
id: API_OPEN_EDITOR_COMMAND_ID,
82+
title: '',
83+
arguments: [this.resource, undefined, undefined]
84+
};
8085

8186
constructor(
8287
private readonly profile: IUserDataProfile,
88+
private readonly resource: URI,
8389
@IInstantiationService private readonly instantiationService: IInstantiationService
8490
) { }
8591

0 commit comments

Comments
 (0)