auto show mgmt editor in unknown state
This commit is contained in:
parent
cdab314713
commit
8094bd9c60
1 changed files with 13 additions and 0 deletions
|
@ -33,6 +33,7 @@ import { EditorInput, Extensions as EditorInputExtensions, IEditorInputSerialize
|
|||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
|
||||
|
||||
const workspaceTrustIcon = registerIcon('workspace-trust-icon', Codicon.shield, localize('workspaceTrustIcon', "Icon for workspace trust badge."));
|
||||
|
||||
|
@ -42,6 +43,7 @@ const workspaceTrustIcon = registerIcon('workspace-trust-icon', Codicon.shield,
|
|||
export class WorkspaceTrustRequestHandler extends Disposable implements IWorkbenchContribution {
|
||||
private readonly requestModel = this.workspaceTrustService.requestModel;
|
||||
private readonly badgeDisposable = this._register(new MutableDisposable());
|
||||
private shouldShowManagementEditor = true;
|
||||
|
||||
constructor(
|
||||
@IHostService private readonly hostService: IHostService,
|
||||
|
@ -53,6 +55,7 @@ export class WorkspaceTrustRequestHandler extends Disposable implements IWorkben
|
|||
@IExtensionService private readonly extensionService: IExtensionService,
|
||||
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
|
||||
@IWorkspaceTrustService private readonly workspaceTrustService: IWorkspaceTrustService,
|
||||
@IStorageService private readonly storageService: IStorageService,
|
||||
) {
|
||||
super();
|
||||
|
||||
|
@ -67,6 +70,13 @@ export class WorkspaceTrustRequestHandler extends Disposable implements IWorkben
|
|||
badge: new IconBadge(workspaceTrustIcon, () => localize('requestTrustIconText', "Some features require workspace trust.")),
|
||||
priority: 10
|
||||
});
|
||||
|
||||
const managementEditorShownKey = 'workspace.trust.management.shown';
|
||||
const seen = this.storageService.getBoolean(managementEditorShownKey, StorageScope.WORKSPACE, false);
|
||||
if (!seen && this.shouldShowManagementEditor) {
|
||||
this.storageService.store(managementEditorShownKey, true, StorageScope.WORKSPACE, StorageTarget.MACHINE);
|
||||
this.commandService.executeCommand('workbench.trust.manage');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,6 +199,9 @@ export class WorkspaceTrustRequestHandler extends Disposable implements IWorkben
|
|||
}
|
||||
}
|
||||
}));
|
||||
|
||||
// Don't auto-show the UX editor if the request is 5 seconds after startup
|
||||
setTimeout(() => { this.shouldShowManagementEditor = false; }, 5000);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue