diff --git a/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.css b/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.css index d6b628efc2b..496e4ebdaf7 100644 --- a/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.css +++ b/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.css @@ -277,6 +277,15 @@ max-width: 100%; } +.workspace-trust-editor .workspace-trust-settings .monaco-table-tr .monaco-table-td .actions { + width: 100%; +} + +.workspace-trust-editor .workspace-trust-settings .monaco-table-tr .monaco-table-td .actions .actions-container { + justify-content: flex-end; + padding-right: 3px; +} + .workspace-trust-editor .workspace-trust-settings .monaco-table-tr .monaco-table-td .monaco-button { height: 18px; padding-left: 8px; diff --git a/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts b/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts index 19d7e24b787..6ffe9bb3f20 100644 --- a/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts +++ b/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts @@ -58,6 +58,7 @@ export const shieldIcon = registerCodicon('workspace-trust-icon', Codicon.shield const checkListIcon = registerCodicon('workspace-trusted-check-icon', Codicon.check); const xListIcon = registerCodicon('workspace-trusted-x-icon', Codicon.x); +const folderPickerIcon = registerCodicon('folder-picker', Codicon.folder); interface ITrustedUriItem { parentOfWorkspaceItem: boolean; @@ -113,16 +114,16 @@ class WorkspaceTrustedUrisTable extends Disposable { { label: localize('pathColumnLabel', "Path"), tooltip: '', - weight: 9, + weight: 8, templateId: TrustedUriPathColumnRenderer.TEMPLATE_ID, project(row: ITrustedUriItem): ITrustedUriItem { return row; } }, { label: '', tooltip: '', - weight: 0, - minimumWidth: 55, - maximumWidth: 55, + weight: 1, + minimumWidth: 75, + maximumWidth: 75, templateId: TrustedUriActionsColumnRenderer.TEMPLATE_ID, project(row: ITrustedUriItem): ITrustedUriItem { return row; } }, @@ -130,7 +131,7 @@ class WorkspaceTrustedUrisTable extends Disposable { [ this.instantiationService.createInstance(TrustedUriHostColumnRenderer), this.instantiationService.createInstance(TrustedUriPathColumnRenderer, this), - this.instantiationService.createInstance(TrustedUriActionsColumnRenderer, this), + this.instantiationService.createInstance(TrustedUriActionsColumnRenderer, this, this.currentWorkspaceUri), ], { horizontalScrolling: false, @@ -154,7 +155,7 @@ class WorkspaceTrustedUrisTable extends Disposable { this._register(this.table.onDidOpen(item => { // default prevented when input box is double clicked #125052 if (item && item.element && !item.browserEvent?.defaultPrevented) { - this.edit(item.element); + this.edit(item.element, true); } })); @@ -302,10 +303,10 @@ class WorkspaceTrustedUrisTable extends Disposable { this._onDelete.fire(item); } - async edit(item: ITrustedUriItem) { + async edit(item: ITrustedUriItem, usePickerIfPossible?: boolean) { const canUseOpenDialog = item.uri.scheme === Schemas.file || (item.uri.scheme === this.currentWorkspaceUri.scheme && this.uriService.extUri.isEqualAuthority(this.currentWorkspaceUri.authority, item.uri.authority)); - if (canUseOpenDialog) { + if (canUseOpenDialog && usePickerIfPossible) { const uri = await this.fileDialogService.showOpenDialog({ canSelectFiles: false, canSelectFolders: true, @@ -347,7 +348,10 @@ class TrustedUriActionsColumnRenderer implements ITableRenderer { - this.table.edit(item); + this.table.edit(item, false); + } + }; + } + + private createPickerAction(item: ITrustedUriItem): IAction { + return { + class: ThemeIcon.asClassName(folderPickerIcon), + enabled: true, + id: 'pickerTrustedUri', + tooltip: localize('pickerTrustedUri', "Open File Picker"), + run: () => { + this.table.edit(item, true); } }; }