@codingame/monaco-vscode-workspace-trust-service-override 2.2.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-workspace-trust-service-override",
3
- "version": "2.2.1",
3
+ "version": "3.0.0",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -18,7 +18,7 @@
18
18
  "module": "index.js",
19
19
  "types": "index.d.ts",
20
20
  "dependencies": {
21
- "vscode": "npm:@codingame/monaco-vscode-api@2.2.1",
21
+ "vscode": "npm:@codingame/monaco-vscode-api@3.0.0",
22
22
  "vscode-marked": "npm:marked@=3.0.2"
23
23
  }
24
24
  }
@@ -10,7 +10,7 @@ import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/c
10
10
  import { Severity } from 'vscode/vscode/vs/platform/notification/common/notification';
11
11
  import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
12
12
  import { workspaceTrustToString, IWorkspaceTrustEnablementService, IWorkspaceTrustManagementService, IWorkspaceTrustRequestService } from 'vscode/vscode/vs/platform/workspace/common/workspaceTrust';
13
- import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
13
+ import { Extensions, registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
14
14
  import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
15
15
  import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
16
16
  import { ContextKeyExpr, IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
@@ -36,7 +36,7 @@ import { WORKSPACE_TRUST_SETTING_TAG } from 'vscode/vscode/vs/workbench/contrib/
36
36
  import { IPreferencesService } from 'vscode/vscode/vs/workbench/services/preferences/common/preferences';
37
37
  import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label';
38
38
  import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService';
39
- import { WorkspaceTrustContext, MANAGE_TRUST_COMMAND_ID } from 'vscode/vscode/vs/workbench/contrib/workspace/common/workspace';
39
+ import { MANAGE_TRUST_COMMAND_ID, WorkspaceTrustContext } from 'vscode/vscode/vs/workbench/contrib/workspace/common/workspace';
40
40
  import { isWeb } from 'vscode/vscode/vs/base/common/platform';
41
41
  import { IRemoteAgentService } from 'vscode/vscode/vs/workbench/services/remote/common/remoteAgentService';
42
42
  import { securityConfigurationNodeBase } from 'vscode/vscode/vs/workbench/common/configuration';
@@ -66,6 +66,7 @@ WorkspaceTrustContextKeys = ( __decorate([
66
66
  ], WorkspaceTrustContextKeys));
67
67
  ( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(WorkspaceTrustContextKeys, 3 );
68
68
  let WorkspaceTrustRequestHandler = class WorkspaceTrustRequestHandler extends Disposable {
69
+ static { this.ID = 'workbench.contrib.workspaceTrustRequestHandler'; }
69
70
  constructor(dialogService, commandService, workspaceContextService, workspaceTrustManagementService, workspaceTrustRequestService) {
70
71
  super();
71
72
  this.dialogService = dialogService;
@@ -78,9 +79,9 @@ let WorkspaceTrustRequestHandler = class WorkspaceTrustRequestHandler extends Di
78
79
  get useWorkspaceLanguage() {
79
80
  return !isSingleFolderWorkspaceIdentifier(toWorkspaceIdentifier(this.workspaceContextService.getWorkspace()));
80
81
  }
81
- async registerListeners() {
82
- await this.workspaceTrustManagementService.workspaceResolved;
82
+ registerListeners() {
83
83
  this._register(this.workspaceTrustRequestService.onDidInitiateOpenFilesTrustRequest(async () => {
84
+ await this.workspaceTrustManagementService.workspaceResolved;
84
85
  const markdownDetails = [
85
86
  this.workspaceContextService.getWorkbenchState() !== 1 ?
86
87
  ( localizeWithPath(
@@ -148,6 +149,7 @@ let WorkspaceTrustRequestHandler = class WorkspaceTrustRequestHandler extends Di
148
149
  });
149
150
  }));
150
151
  this._register(this.workspaceTrustRequestService.onDidInitiateWorkspaceTrustRequest(async (requestOptions) => {
152
+ await this.workspaceTrustManagementService.workspaceResolved;
151
153
  const message = this.useWorkspaceLanguage ?
152
154
  ( localizeWithPath(
153
155
  'vs/workbench/contrib/workspace/browser/workspace.contribution',
@@ -262,13 +264,13 @@ let WorkspaceTrustUXHandler = class WorkspaceTrustUXHandler extends Disposable {
262
264
  this.remoteAgentService = remoteAgentService;
263
265
  this.environmentService = environmentService;
264
266
  this.fileService = fileService;
265
- this.entryId = `status.workspaceTrust.${this.workspaceContextService.getWorkspace().id}`;
267
+ this.entryId = `status.workspaceTrust`;
266
268
  this.statusbarEntryAccessor = this._register(( new MutableDisposable()));
267
269
  (async () => {
268
270
  await this.workspaceTrustManagementService.workspaceTrustInitialized;
269
271
  if (this.workspaceTrustEnablementService.isWorkspaceTrustEnabled()) {
270
272
  this.registerListeners();
271
- this.createStatusbarEntry();
273
+ this.updateStatusbarEntry(this.workspaceTrustManagementService.isWorkspaceTrusted());
272
274
  if (this.hostService.hasFocus) {
273
275
  this.showModalOnStart();
274
276
  }
@@ -601,11 +603,6 @@ let WorkspaceTrustUXHandler = class WorkspaceTrustUXHandler extends Disposable {
601
603
  }
602
604
  return result;
603
605
  }
604
- createStatusbarEntry() {
605
- const entry = this.getStatusbarEntry(this.workspaceTrustManagementService.isWorkspaceTrusted());
606
- this.statusbarEntryAccessor.value = this.statusbarService.addEntry(entry, this.entryId, 0 , 0.99 * Number.MAX_VALUE );
607
- this.statusbarService.updateEntryVisibility(this.entryId, false);
608
- }
609
606
  getStatusbarEntry(trusted) {
610
607
  const text = workspaceTrustToString(trusted);
611
608
  let ariaLabel = '';
@@ -698,8 +695,14 @@ let WorkspaceTrustUXHandler = class WorkspaceTrustUXHandler extends Disposable {
698
695
  };
699
696
  }
700
697
  updateStatusbarEntry(trusted) {
701
- this.statusbarEntryAccessor.value?.update(this.getStatusbarEntry(trusted));
702
- this.statusbarService.updateEntryVisibility(this.entryId, !trusted);
698
+ if (trusted && this.statusbarEntryAccessor.value) {
699
+ this.statusbarEntryAccessor.clear();
700
+ return;
701
+ }
702
+ if (!trusted && !this.statusbarEntryAccessor.value) {
703
+ const entry = this.getStatusbarEntry(trusted);
704
+ this.statusbarEntryAccessor.value = this.statusbarService.addEntry(entry, this.entryId, 0 , 0.99 * Number.MAX_VALUE );
705
+ }
703
706
  }
704
707
  };
705
708
  WorkspaceTrustUXHandler = ( __decorate([
@@ -719,7 +722,7 @@ WorkspaceTrustUXHandler = ( __decorate([
719
722
  ( __param(13, IEnvironmentService)),
720
723
  ( __param(14, IFileService))
721
724
  ], WorkspaceTrustUXHandler));
722
- ( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(WorkspaceTrustRequestHandler, 2 );
725
+ registerWorkbenchContribution2(WorkspaceTrustRequestHandler.ID, WorkspaceTrustRequestHandler, 2 );
723
726
  ( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(WorkspaceTrustUXHandler, 3 );
724
727
  class WorkspaceTrustEditorInputSerializer {
725
728
  canSerialize(editorInput) {
@@ -751,11 +754,11 @@ registerAction2(class extends Action2 {
751
754
  constructor() {
752
755
  super({
753
756
  id: CONFIGURE_TRUST_COMMAND_ID,
754
- title: { original: 'Configure Workspace Trust Settings', value: ( localizeWithPath(
757
+ title: ( localize2WithPath(
755
758
  'vs/workbench/contrib/workspace/browser/workspace.contribution',
756
759
  'configureWorkspaceTrustSettings',
757
760
  "Configure Workspace Trust Settings"
758
- )) },
761
+ )),
759
762
  precondition: ( ContextKeyExpr.and(WorkspaceTrustContext.IsEnabled, ( ContextKeyExpr.equals(`config.${WORKSPACE_TRUST_ENABLED}`, true)))),
760
763
  category: WORKSPACES_CATEGORY,
761
764
  f1: true
@@ -769,11 +772,11 @@ registerAction2(class extends Action2 {
769
772
  constructor() {
770
773
  super({
771
774
  id: MANAGE_TRUST_COMMAND_ID,
772
- title: { original: 'Manage Workspace Trust', value: ( localizeWithPath(
775
+ title: ( localize2WithPath(
773
776
  'vs/workbench/contrib/workspace/browser/workspace.contribution',
774
777
  'manageWorkspaceTrust',
775
778
  "Manage Workspace Trust"
776
- )) },
779
+ )),
777
780
  precondition: ( ContextKeyExpr.and(WorkspaceTrustContext.IsEnabled, ( ContextKeyExpr.equals(`config.${WORKSPACE_TRUST_ENABLED}`, true)))),
778
781
  category: WORKSPACES_CATEGORY,
779
782
  f1: true,
@@ -428,7 +428,7 @@ let TrustedUriActionsColumnRenderer = class TrustedUriActionsColumnRenderer {
428
428
  }
429
429
  renderTemplate(container) {
430
430
  const element = container.appendChild($('.actions'));
431
- const actionBar = ( new ActionBar(element, { animated: false }));
431
+ const actionBar = ( new ActionBar(element));
432
432
  return { actionBar };
433
433
  }
434
434
  renderElement(item, index, templateData, height) {