Trusted Workspaces Feature Branch Merge (#115961)

* draft trusted workspace service / model

* renaming

* add request model and action

* err fix

* add request handlers with mock actions

* some quick fixes

* adding badge icon to activity bar gear

* Add Statusbar item to indicate trust

* Cleanup code

* Add background color

* Use theme color for the status background color

* adding basic editing experience

* observe trust with startup tasks

* Extension enablement

* Add capability to provide a custom message

* Remove old actions

* explorer: if you can not undo, pass undo to editor

fixes #111630

* Remove plug icon from ports view
Part of https://github.com/microsoft/vscode-internalbacklog/issues/1689

* Fixed compilation error

* Handle extension uninstall

* Handle extension install

* Ability to prompt when state is untrusted

* Do not change state is the modal dialog is dismissed or the Cancel button is pressed

* Refactored enablement code

* Prompt when installing from VSIX

* Prompt when installing from the Gallery

* Move file into the browser folder

* fixes and polish

* restructure workspace contributions

* restructure actions and use confirmations

* Initial draft of the proposed APIs

* Added stubs for the proposed api

* Trusted Workspace proposed API

* Fix a regression introduced by merge

* status bar indicator improvements

* remove helper command as we now have hooks

* verbose messaging for the immediate request

* add indication to global activity icon of pending request

* try personal title

* Add configuration setting

* Add additional extension actions

* Fix contributions

* Removed context key that is not needed

* Fixed issue with the dialog

* Reduce arbitrary event limiter from 16ms down to 4.16666 (support for monitors up-to 240hz) #107016

* Fixes #115221: update emoji tests

* Give a higher priority to language configuration set via API call (#114684)

* debug console menu action polish

* Avoid the CSS general sibling combinator ~ for perf reasons

* more notebook todos

* Use label as tooltip fallback properly
Part of #115337

* Fixes microsoft/monaco-editor#2329: Move `registerThemingParticipant` call to `/editor/`

* Fix port label not always getting set
Part of microsoft/vscode-remote-release#4364

* simplify map creation, fyi @bpasero

* Fix #114432: Multiple save dialogs appearing on Windows if Ctrl+S is pressed multiple times (#114450)

* fix multiple save dialogs appearing on Windows when spamming Ctrl+S

* remove old fix and instead keep track of windows with open dialogs in the dialogMainService

* keep initialisation of activeWindowDialogs in constructor

* remove unused variable

* some changes

* queue dialogs based on hash of options

* simplify structure, fix comment typo

* Apply suggestions from code review

Co-authored-by: Benjamin Pasero <benjamin.pasero@gmail.com>

* remove unnecessary async/await for aquireFileDialogLock method

* don't acquire file dialog lock for message boxes

* use MessageBoxReturnValue | SaveDialogReturnValue | OpenDialogReturnValue instead of any type for getWindowDialogQueue

* Apply suggestions from code review

Co-authored-by: Benjamin Pasero <benjamin.pasero@gmail.com>

Co-authored-by: Benjamin Pasero <benjpas@microsoft.com>
Co-authored-by: Benjamin Pasero <benjamin.pasero@gmail.com>

* 💄 dialog main service locks

* debt - adopt some ? operator

* Better hiding of custom hover in icon label

* Limit to 8ms (120fps)

* more API todos for notebooks

* 💄

* Update grammars

* chore - group notebook specific api proposals together

* added unreleased fixes to endgame notebook

* Add changes back to the modal dialog

* Add back the workspace trust proposed APIs

* Adjust dialog buttons

* Standardize on WorkspaceTrust name across interfaces, classes, variables

* Renamed some of the missing keys

* Add TestWorkspaceTrust stub and fix failing tests

* Add requiresWorkspaceTrust property to fix test failure

* remove notebook change

Co-authored-by: Ladislau Szomoru <lszomoru@microsoft.com>
Co-authored-by: isidor <inikolic@microsoft.com>
Co-authored-by: Alex Ross <alros@microsoft.com>
Co-authored-by: TacticalDan <gorksorf@gmail.com>
Co-authored-by: Alexandru Dima <alexdima@microsoft.com>
Co-authored-by: Johannes Rieken <johannes.rieken@gmail.com>
Co-authored-by: Cameron <cameron532@gmail.com>
Co-authored-by: Benjamin Pasero <benjpas@microsoft.com>
Co-authored-by: Benjamin Pasero <benjamin.pasero@gmail.com>
This commit is contained in:
SteVen Batten
2021-02-06 00:38:32 -08:00
committed by GitHub
parent 01a3787cca
commit afd102cbd2
33 changed files with 1220 additions and 54 deletions

View File

@@ -20,11 +20,12 @@ import { FileSystemProviderCapabilities } from 'vs/platform/files/common/files';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { ILogService } from 'vs/platform/log/common/log';
import { Severity } from 'vs/platform/notification/common/notification';
import { WorkspaceTrustStateChangeEvent } from 'vs/platform/workspace/common/workspaceTrust';
import { Workspace, WorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import { IExtHostFileSystemInfo } from 'vs/workbench/api/common/extHostFileSystemInfo';
import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService';
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
import { Range, RelativePattern } from 'vs/workbench/api/common/extHostTypes';
import { Range, RelativePattern, WorkspaceTrustState } from 'vs/workbench/api/common/extHostTypes';
import { ITextQueryBuilderOptions } from 'vs/workbench/contrib/search/common/queryBuilder';
import { IRawFileMatch2, resultIsMatch } from 'vs/workbench/services/search/common/search';
import * as vscode from 'vscode';
@@ -168,6 +169,9 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac
private readonly _onDidChangeWorkspace = new Emitter<vscode.WorkspaceFoldersChangeEvent>();
readonly onDidChangeWorkspace: Event<vscode.WorkspaceFoldersChangeEvent> = this._onDidChangeWorkspace.event;
private readonly _onDidChangeWorkspaceTrustState = new Emitter<vscode.WorkspaceTrustStateChangeEvent>();
readonly onDidChangeWorkspaceTrustState: Event<vscode.WorkspaceTrustStateChangeEvent> = this._onDidChangeWorkspaceTrustState.event;
private readonly _logService: ILogService;
private readonly _requestIdProvider: Counter;
private readonly _barrier: Barrier;
@@ -181,6 +185,8 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac
private readonly _activeSearchCallbacks: ((match: IRawFileMatch2) => any)[] = [];
private _workspaceTrustState: WorkspaceTrustState = WorkspaceTrustState.Unknown;
constructor(
@IExtHostRpcService extHostRpc: IExtHostRpcService,
@IExtHostInitDataService initData: IExtHostInitDataService,
@@ -198,7 +204,8 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac
this._confirmedWorkspace = data ? new ExtHostWorkspaceImpl(data.id, data.name, [], data.configuration ? URI.revive(data.configuration) : null, !!data.isUntitled, uri => ignorePathCasing(uri, extHostFileSystemInfo)) : undefined;
}
$initializeWorkspace(data: IWorkspaceData | null): void {
$initializeWorkspace(data: IWorkspaceData | null, trustState: WorkspaceTrustState): void {
this._workspaceTrustState = trustState;
this.$acceptWorkspaceData(data);
this._barrier.open();
}
@@ -549,6 +556,21 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac
resolveProxy(url: string): Promise<string | undefined> {
return this._proxy.$resolveProxy(url);
}
// --- trust ---
get trustState(): WorkspaceTrustState {
return this._workspaceTrustState;
}
requireWorkspaceTrust(message?: string): Promise<WorkspaceTrustState> {
return this._proxy.$requireWorkspaceTrust(message);
}
$onDidChangeWorkspaceTrustState(state: WorkspaceTrustStateChangeEvent): void {
this._workspaceTrustState = state.currentTrustState;
this._onDidChangeWorkspaceTrustState.fire(Object.freeze(state));
}
}
export const IExtHostWorkspace = createDecorator<IExtHostWorkspace>('IExtHostWorkspace');