diff --git a/.eslintrc.json b/.eslintrc.json index 47731490701..fb2e489fe07 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1010,6 +1010,7 @@ "edit", "end", "expand", + "grant", "hide", "invalidate", "open", diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index 428e4e373f9..ad38c32f8bb 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -10697,6 +10697,16 @@ declare module 'vscode' { * @return A [disposable](#Disposable) that unregisters this provider when being disposed. */ export function registerFileSystemProvider(scheme: string, provider: FileSystemProvider, options?: { readonly isCaseSensitive?: boolean, readonly isReadonly?: boolean }): Disposable; + + /** + * When true, the user has explicitly trusted the contents of the workspace. + */ + export const isTrusted: boolean; + + /** + * Event that fires when the current workspace has been trusted. + */ + export const onDidGrantWorkspaceTrust: Event; } /** diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index e4a2a9a043f..a5e1e706ff4 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -2978,25 +2978,15 @@ declare module 'vscode' { } export namespace workspace { - /** - * When true, the user has explicitly trusted the contents of the workspace. - */ - export const isTrusted: boolean; - /** * 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 - * `onDidReceiveWorkspaceTrust` event to listen for trust changes. + * `onDidGrantWorkspaceTrust` event to listen for trust changes. */ export function requestWorkspaceTrust(options?: WorkspaceTrustRequestOptions): Thenable; - - /** - * Event that fires when the current workspace has been trusted. - */ - export const onDidReceiveWorkspaceTrust: Event; } //#endregion diff --git a/src/vs/workbench/api/browser/mainThreadWorkspace.ts b/src/vs/workbench/api/browser/mainThreadWorkspace.ts index 046b15b9db0..8783251ab6b 100644 --- a/src/vs/workbench/api/browser/mainThreadWorkspace.ts +++ b/src/vs/workbench/api/browser/mainThreadWorkspace.ts @@ -61,7 +61,7 @@ export class MainThreadWorkspace implements MainThreadWorkspaceShape { } this._contextService.onDidChangeWorkspaceFolders(this._onDidChangeWorkspace, this, this._toDispose); this._contextService.onDidChangeWorkbenchState(this._onDidChangeWorkspace, this, this._toDispose); - this._workspaceTrustManagementService.onDidChangeTrust(this._onDidReceiveWorkspaceTrust, this, this._toDispose); + this._workspaceTrustManagementService.onDidChangeTrust(this._onDidGrantWorkspaceTrust, this, this._toDispose); } dispose(): void { @@ -217,7 +217,7 @@ export class MainThreadWorkspace implements MainThreadWorkspaceShape { return this._workspaceTrustManagementService.isWorkpaceTrusted(); } - private _onDidReceiveWorkspaceTrust(): void { - this._proxy.$onDidReceiveWorkspaceTrust(); + private _onDidGrantWorkspaceTrust(): void { + this._proxy.$onDidGrantWorkspaceTrust(); } } diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index d6693dac63a..3fd03f1b18f 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -921,15 +921,14 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I return extHostTimeline.registerTimelineProvider(scheme, provider, extension.identifier, extHostCommands.converter); }, get isTrusted() { - checkProposedApiEnabled(extension); return extHostWorkspace.trusted; }, requestWorkspaceTrust: (options?: vscode.WorkspaceTrustRequestOptions) => { checkProposedApiEnabled(extension); return extHostWorkspace.requestWorkspaceTrust(options); }, - onDidReceiveWorkspaceTrust: (listener, thisArgs?, disposables?) => { - return extHostWorkspace.onDidReceiveWorkspaceTrust(listener, thisArgs, disposables); + onDidGrantWorkspaceTrust: (listener, thisArgs?, disposables?) => { + return extHostWorkspace.onDidGrantWorkspaceTrust(listener, thisArgs, disposables); } }; diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 4b495f61980..61bf086e9e0 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -1239,7 +1239,7 @@ export interface ExtHostWorkspaceShape { $initializeWorkspace(workspace: IWorkspaceData | null, trusted: boolean): void; $acceptWorkspaceData(workspace: IWorkspaceData | null): void; $handleTextSearchResult(result: search.IRawFileMatch2, requestId: number): void; - $onDidReceiveWorkspaceTrust(): void; + $onDidGrantWorkspaceTrust(): void; } export interface ExtHostFileSystemInfoShape { diff --git a/src/vs/workbench/api/common/extHostWorkspace.ts b/src/vs/workbench/api/common/extHostWorkspace.ts index 5f0bc4cea9a..20e7707dd26 100644 --- a/src/vs/workbench/api/common/extHostWorkspace.ts +++ b/src/vs/workbench/api/common/extHostWorkspace.ts @@ -168,8 +168,8 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac private readonly _onDidChangeWorkspace = new Emitter(); readonly onDidChangeWorkspace: Event = this._onDidChangeWorkspace.event; - private readonly _onDidReceieveWorkspaceTrust = new Emitter(); - readonly onDidReceiveWorkspaceTrust: Event = this._onDidReceieveWorkspaceTrust.event; + private readonly _onDidGrantWorkspaceTrust = new Emitter(); + readonly onDidGrantWorkspaceTrust: Event = this._onDidGrantWorkspaceTrust.event; private readonly _logService: ILogService; private readonly _requestIdProvider: Counter; @@ -567,10 +567,10 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac return options?.modal ? promise : Promise.resolve(this._trusted); } - $onDidReceiveWorkspaceTrust(): void { + $onDidGrantWorkspaceTrust(): void { if (!this._trusted) { this._trusted = true; - this._onDidReceieveWorkspaceTrust.fire(); + this._onDidGrantWorkspaceTrust.fire(); } } }