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

Take profile to preview as URI #171814

Merged
merged 1 commit into from
Jan 20, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/vs/workbench/browser/web.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,10 @@ export interface IWorkbenchConstructionOptions {

//#region Profile options

readonly profile?: string;
/**
* URI of the profile to preview.
*/
readonly profileToPreview?: UriComponents;

//#endregion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,20 @@
*--------------------------------------------------------------------------------------------*/

import { Disposable } from 'vs/base/common/lifecycle';
import { IProductService } from 'vs/platform/product/common/productService';
import { URI } from 'vs/base/common/uri';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { IBrowserWorkbenchEnvironmentService } from 'vs/workbench/services/environment/browser/environmentService';
import { IUserDataProfileImportExportService, toUserDataProfileUri } from 'vs/workbench/services/userDataProfile/common/userDataProfile';
import { IUserDataProfileImportExportService } from 'vs/workbench/services/userDataProfile/common/userDataProfile';

export class UserDataProfilePreviewContribution extends Disposable implements IWorkbenchContribution {

constructor(
@IBrowserWorkbenchEnvironmentService environmentService: IBrowserWorkbenchEnvironmentService,
@IProductService productService: IProductService,
@IUserDataProfileImportExportService userDataProfileImportExportService: IUserDataProfileImportExportService
) {
super();
if (environmentService.options?.profile) {
userDataProfileImportExportService.importProfile(toUserDataProfileUri(environmentService.options?.profile, productService), { donotPrompt: true, previewAsTempProfile: true });
if (environmentService.options?.profileToPreview) {
userDataProfileImportExportService.importProfile(URI.revive(environmentService.options.profileToPreview), { donotPrompt: true, previewAsTempProfile: true });
}
}

Expand Down