Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

polish import/export #166703

Merged
merged 1 commit into from
Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -261,24 +261,24 @@ const jsonRegistry = <jsonContributionRegistry.IJSONContributionRegistry>Registr
jsonRegistry.registerSchema(ExtensionsConfigurationSchemaId, ExtensionsConfigurationSchema);

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

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

const [extension] = await extensionService.getExtensions([{ id: extensionId }], CancellationToken.None);
if (extension) {
return extensionService.open(extension, { tab });
return extensionService.open(extension, { tab, preserveFocus });
}

return commandService.executeCommand('_extensions.manage', extensionId, tab);
return commandService.executeCommand('_extensions.manage', extensionId, tab, preserveFocus);
});

CommandsRegistry.registerCommand({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export class ExtensionsResourceExportTreeItem implements IProfileResourceTreeIte
command: {
id: 'extension.open',
title: '',
arguments: [e.identifier.id]
arguments: [e.identifier.id, undefined, true]
}
}));
}
Expand Down Expand Up @@ -214,11 +214,16 @@ export class ExtensionsResourceImportTreeItem implements IProfileResourceTreeIte
command: {
id: 'extension.open',
title: '',
arguments: [e.identifier.id]
arguments: [e.identifier.id, undefined, true]
}
}));
}

async hasContent(): Promise<boolean> {
const extensions = await this.instantiationService.createInstance(ExtensionsResource).getProfileExtensions(this.content);
return extensions.length > 0;
}

}


Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,15 @@ export class GlobalStateResourceExportTreeItem implements IProfileResourceTreeIt
readonly label = { label: localize('globalState', "UI State") };
readonly collapsibleState = TreeItemCollapsibleState.None;
checkbox: ITreeItemCheckboxState = { isChecked: true };
readonly command = {
id: API_OPEN_EDITOR_COMMAND_ID,
title: '',
arguments: [this.resource, undefined, undefined]
};

constructor(
private readonly profile: IUserDataProfile,
private readonly resource: URI,
@IInstantiationService private readonly instantiationService: IInstantiationService
) { }

Expand Down
Loading