Cleanup modal property from proposed api

This commit is contained in:
Ladislau Szomoru 2021-05-02 14:22:41 +02:00
parent 119055dec7
commit 3edce10f20
No known key found for this signature in database
GPG key ID: 2B88287CB9DB080B
3 changed files with 7 additions and 10 deletions

View file

@ -115,7 +115,7 @@ export class TypeScriptVersionManager extends Disposable {
description: version.displayName,
detail: version.pathLabel,
run: async () => {
const trusted = await vscode.workspace.requestWorkspaceTrust({ modal: true });
const trusted = await vscode.workspace.requestWorkspaceTrust();
if (trusted) {
await this.workspaceState.update(useWorkspaceTsdkStorageKey, true);
const tsConfig = vscode.workspace.getConfiguration('typescript');

View file

@ -3027,20 +3027,18 @@ declare module 'vscode' {
*/
export interface WorkspaceTrustRequestOptions {
/**
* When true, a modal dialog will be used to request workspace trust.
* When false, a badge will be displayed on the settings gear activity bar item.
* Custom message describing the user action that requires workspace
* trust. If omitted, a generic message will be displayed in the workspace
* trust request dialog.
*/
readonly modal: boolean;
readonly message?: string;
}
export namespace workspace {
/**
* Prompt the user to chose whether to trust the current workspace
* @param options Optional object describing the properties of the
* workspace trust request. Defaults to { modal: false }
* When using a non-modal request, the promise will return immediately.
* Any time trust is not given, it is recommended to use the
* `onDidGrantWorkspaceTrust` event to listen for trust changes.
* workspace trust request.
*/
export function requestWorkspaceTrust(options?: WorkspaceTrustRequestOptions): Thenable<boolean | undefined>;
}

View file

@ -563,8 +563,7 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac
}
requestWorkspaceTrust(options?: vscode.WorkspaceTrustRequestOptions): Promise<boolean | undefined> {
const promise = this._proxy.$requestWorkspaceTrust(options);
return options?.modal ? promise : Promise.resolve(this._trusted);
return this._proxy.$requestWorkspaceTrust(options);
}
$onDidGrantWorkspaceTrust(): void {