setParentFolderTrust should use canSetParentFolderTrust

This commit is contained in:
Ladislau Szomoru 2021-07-15 13:29:43 +02:00
parent f50840e91b
commit 41c2f164b3
No known key found for this signature in database
GPG key ID: 2B88287CB9DB080B

View file

@ -16,7 +16,7 @@ import { getRemoteAuthority, isVirtualResource } from 'vs/platform/remote/common
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
import { IWorkspace, IWorkspaceContextService, IWorkspaceFolder, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { WorkspaceTrustRequestOptions, IWorkspaceTrustManagementService, IWorkspaceTrustInfo, IWorkspaceTrustUriInfo, IWorkspaceTrustRequestService, IWorkspaceTrustTransitionParticipant, WorkspaceTrustUriResponse, IWorkspaceTrustEnablementService } from 'vs/platform/workspace/common/workspaceTrust';
import { isSingleFolderWorkspaceIdentifier, isUntitledWorkspace, toWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
import { ISingleFolderWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, isUntitledWorkspace, toWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
import { Memento, MementoObject } from 'vs/workbench/common/memento';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity';
@ -483,9 +483,8 @@ export class WorkspaceTrustManagementService extends Disposable implements IWork
}
async setParentFolderTrust(trusted: boolean): Promise<void> {
const workspaceIdentifier = toWorkspaceIdentifier(this._canonicalWorkspace);
if (isSingleFolderWorkspaceIdentifier(workspaceIdentifier) && workspaceIdentifier.uri.scheme === Schemas.file) {
const { parentPath } = splitName(workspaceIdentifier.uri.fsPath);
if (this.canSetParentFolderTrust()) {
const { parentPath } = splitName((toWorkspaceIdentifier(this._canonicalWorkspace) as ISingleFolderWorkspaceIdentifier).uri.fsPath);
await this.setUrisTrust([URI.file(parentPath)], trusted);
}