@codingame/monaco-vscode-workspace-trust-service-override 5.3.0 → 6.0.1
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 +2 -2
- package/vscode/src/vs/workbench/contrib/workspace/browser/workspace.contribution.js +38 -33
- package/vscode/src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.js +35 -29
- package/vscode/src/vs/workbench/services/workspaces/browser/workspaceTrustEditorInput.js +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-workspace-trust-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"vscode": "npm:@codingame/monaco-vscode-api@
|
|
29
|
+
"vscode": "npm:@codingame/monaco-vscode-api@6.0.1"
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -4,18 +4,21 @@ import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/d
|
|
|
4
4
|
import { Disposable, MutableDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
5
|
import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
|
|
6
6
|
import { registerAction2, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
7
|
-
import { Extensions as Extensions$1 } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
|
|
7
|
+
import { Extensions as Extensions$1, ConfigurationScope } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
|
|
8
8
|
import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
9
9
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
10
10
|
import 'vscode/vscode/vs/platform/notification/common/notification';
|
|
11
11
|
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
12
|
+
import { WorkspaceTrustUriResponse } from 'vscode/vscode/vs/platform/workspace/common/workspaceTrust';
|
|
12
13
|
import { IWorkspaceTrustEnablementService, IWorkspaceTrustManagementService, IWorkspaceTrustRequestService } from 'vscode/vscode/vs/platform/workspace/common/workspaceTrust.service';
|
|
13
|
-
import { Extensions, registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
14
|
+
import { Extensions, registerWorkbenchContribution2, WorkbenchPhase } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
15
|
+
import { LifecyclePhase } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
|
|
14
16
|
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
15
17
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
16
18
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
17
19
|
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
18
20
|
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands.service';
|
|
21
|
+
import { StatusbarAlignment } from 'vscode/vscode/vs/workbench/services/statusbar/browser/statusbar';
|
|
19
22
|
import { IStatusbarService } from 'vscode/vscode/vs/workbench/services/statusbar/browser/statusbar.service';
|
|
20
23
|
import { EditorPaneDescriptor } from 'vscode/vscode/vs/workbench/browser/editor';
|
|
21
24
|
import { shieldIcon, WorkspaceTrustEditor } from './workspaceTrustEditor.js';
|
|
@@ -23,11 +26,12 @@ import { WorkspaceTrustEditorInput } from '../../../services/workspaces/browser/
|
|
|
23
26
|
import { WORKSPACE_TRUST_STARTUP_PROMPT, WORKSPACE_TRUST_BANNER, WORKSPACE_TRUST_ENABLED, WORKSPACE_TRUST_UNTRUSTED_FILES, WORKSPACE_TRUST_EMPTY_WINDOW } from 'vscode/vscode/vs/workbench/services/workspaces/common/workspaceTrust';
|
|
24
27
|
import { EditorExtensions } from 'vscode/vscode/vs/workbench/common/editor';
|
|
25
28
|
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
26
|
-
import { isSingleFolderWorkspaceIdentifier, toWorkspaceIdentifier, isEmptyWorkspaceIdentifier } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
29
|
+
import { isSingleFolderWorkspaceIdentifier, toWorkspaceIdentifier, WorkbenchState, isEmptyWorkspaceIdentifier } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
27
30
|
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
|
|
28
31
|
import { resolve, dirname as dirname$1 } from 'vscode/vscode/vs/base/common/path';
|
|
29
32
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
30
33
|
import { MarkdownString } from 'vscode/vscode/vs/base/common/htmlContent';
|
|
34
|
+
import { StorageScope, StorageTarget } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
31
35
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
32
36
|
import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host.service';
|
|
33
37
|
import { IBannerService } from 'vscode/vscode/vs/workbench/services/banner/browser/bannerService.service';
|
|
@@ -36,6 +40,7 @@ import { LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID } from 'vscode/vscode/
|
|
|
36
40
|
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService.service';
|
|
37
41
|
import { WORKSPACE_TRUST_SETTING_TAG } from 'vscode/vscode/vs/workbench/contrib/preferences/common/preferences';
|
|
38
42
|
import { IPreferencesService } from 'vscode/vscode/vs/workbench/services/preferences/common/preferences.service';
|
|
43
|
+
import { Verbosity } from 'vscode/vscode/vs/platform/label/common/label';
|
|
39
44
|
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label.service';
|
|
40
45
|
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
|
|
41
46
|
import { WorkspaceTrustContext, MANAGE_TRUST_COMMAND_ID } from 'vscode/vscode/vs/workbench/contrib/workspace/common/workspace';
|
|
@@ -67,7 +72,7 @@ WorkspaceTrustContextKeys = ( (__decorate([
|
|
|
67
72
|
( (__param(1, IWorkspaceTrustEnablementService))),
|
|
68
73
|
( (__param(2, IWorkspaceTrustManagementService)))
|
|
69
74
|
], WorkspaceTrustContextKeys)));
|
|
70
|
-
( (Registry.as(Extensions.Workbench))).registerWorkbenchContribution(WorkspaceTrustContextKeys,
|
|
75
|
+
( (Registry.as(Extensions.Workbench))).registerWorkbenchContribution(WorkspaceTrustContextKeys, LifecyclePhase.Restored);
|
|
71
76
|
let WorkspaceTrustRequestHandler = class WorkspaceTrustRequestHandler extends Disposable {
|
|
72
77
|
static { this.ID = 'workbench.contrib.workspaceTrustRequestHandler'; }
|
|
73
78
|
constructor(dialogService, commandService, workspaceContextService, workspaceTrustManagementService, workspaceTrustRequestService) {
|
|
@@ -86,7 +91,7 @@ let WorkspaceTrustRequestHandler = class WorkspaceTrustRequestHandler extends Di
|
|
|
86
91
|
this._register(this.workspaceTrustRequestService.onDidInitiateOpenFilesTrustRequest(async () => {
|
|
87
92
|
await this.workspaceTrustManagementService.workspaceResolved;
|
|
88
93
|
const markdownDetails = [
|
|
89
|
-
this.workspaceContextService.getWorkbenchState() !==
|
|
94
|
+
this.workspaceContextService.getWorkbenchState() !== WorkbenchState.EMPTY ?
|
|
90
95
|
( localizeWithPath(
|
|
91
96
|
_moduleId,
|
|
92
97
|
0,
|
|
@@ -105,21 +110,21 @@ let WorkspaceTrustRequestHandler = class WorkspaceTrustRequestHandler extends Di
|
|
|
105
110
|
];
|
|
106
111
|
await this.dialogService.prompt({
|
|
107
112
|
type: Severity$1.Info,
|
|
108
|
-
message: this.workspaceContextService.getWorkbenchState() !==
|
|
113
|
+
message: this.workspaceContextService.getWorkbenchState() !== WorkbenchState.EMPTY ?
|
|
109
114
|
( localizeWithPath(_moduleId, 3, "Do you want to allow untrusted files in this workspace?")) :
|
|
110
115
|
( localizeWithPath(_moduleId, 4, "Do you want to allow untrusted files in this window?")),
|
|
111
116
|
buttons: [
|
|
112
117
|
{
|
|
113
118
|
label: ( localizeWithPath(_moduleId, 5, "&&Open")),
|
|
114
|
-
run: ({ checkboxChecked }) => this.workspaceTrustRequestService.completeOpenFilesTrustRequest(
|
|
119
|
+
run: ({ checkboxChecked }) => this.workspaceTrustRequestService.completeOpenFilesTrustRequest(WorkspaceTrustUriResponse.Open, !!checkboxChecked)
|
|
115
120
|
},
|
|
116
121
|
{
|
|
117
122
|
label: ( localizeWithPath(_moduleId, 6, "Open in &&Restricted Mode")),
|
|
118
|
-
run: ({ checkboxChecked }) => this.workspaceTrustRequestService.completeOpenFilesTrustRequest(
|
|
123
|
+
run: ({ checkboxChecked }) => this.workspaceTrustRequestService.completeOpenFilesTrustRequest(WorkspaceTrustUriResponse.OpenInNewWindow, !!checkboxChecked)
|
|
119
124
|
}
|
|
120
125
|
],
|
|
121
126
|
cancelButton: {
|
|
122
|
-
run: () => this.workspaceTrustRequestService.completeOpenFilesTrustRequest(
|
|
127
|
+
run: () => this.workspaceTrustRequestService.completeOpenFilesTrustRequest(WorkspaceTrustUriResponse.Cancel)
|
|
123
128
|
},
|
|
124
129
|
checkbox: {
|
|
125
130
|
label: ( localizeWithPath(_moduleId, 7, "Remember my decision for all workspaces")),
|
|
@@ -328,7 +333,7 @@ let WorkspaceTrustUXHandler = class WorkspaceTrustUXHandler extends Disposable {
|
|
|
328
333
|
"If you don't trust the authors of these files, we recommend to continue in restricted mode as the files may be malicious. See [our docs](https://aka.ms/vscode-workspace-trust) to learn more."
|
|
329
334
|
)),
|
|
330
335
|
!isEmptyWindow ?
|
|
331
|
-
`\`${this.labelService.getWorkspaceLabel(workspaceIdentifier, { verbose:
|
|
336
|
+
`\`${this.labelService.getWorkspaceLabel(workspaceIdentifier, { verbose: Verbosity.LONG })}\`` : '',
|
|
332
337
|
], checkboxText);
|
|
333
338
|
}));
|
|
334
339
|
}
|
|
@@ -381,7 +386,7 @@ let WorkspaceTrustUXHandler = class WorkspaceTrustUXHandler extends Disposable {
|
|
|
381
386
|
markdownDetails: ( (markdownStrings.map(md => { return { markdown: ( (new MarkdownString(md))) }; })))
|
|
382
387
|
}
|
|
383
388
|
});
|
|
384
|
-
this.storageService.store(STARTUP_PROMPT_SHOWN_KEY, true,
|
|
389
|
+
this.storageService.store(STARTUP_PROMPT_SHOWN_KEY, true, StorageScope.WORKSPACE, StorageTarget.MACHINE);
|
|
385
390
|
}
|
|
386
391
|
async showModalOnStart() {
|
|
387
392
|
if (this.workspaceTrustManagementService.isWorkspaceTrusted()) {
|
|
@@ -395,7 +400,7 @@ let WorkspaceTrustUXHandler = class WorkspaceTrustUXHandler extends Disposable {
|
|
|
395
400
|
this.updateWorkbenchIndicators(false);
|
|
396
401
|
return;
|
|
397
402
|
}
|
|
398
|
-
if (this.workspaceContextService.getWorkbenchState() ===
|
|
403
|
+
if (this.workspaceContextService.getWorkbenchState() === WorkbenchState.EMPTY) {
|
|
399
404
|
this.updateWorkbenchIndicators(false);
|
|
400
405
|
return;
|
|
401
406
|
}
|
|
@@ -403,7 +408,7 @@ let WorkspaceTrustUXHandler = class WorkspaceTrustUXHandler extends Disposable {
|
|
|
403
408
|
this.updateWorkbenchIndicators(false);
|
|
404
409
|
return;
|
|
405
410
|
}
|
|
406
|
-
if (this.startupPromptSetting === 'once' && this.storageService.getBoolean(STARTUP_PROMPT_SHOWN_KEY,
|
|
411
|
+
if (this.startupPromptSetting === 'once' && this.storageService.getBoolean(STARTUP_PROMPT_SHOWN_KEY, StorageScope.WORKSPACE, false)) {
|
|
407
412
|
this.updateWorkbenchIndicators(false);
|
|
408
413
|
return;
|
|
409
414
|
}
|
|
@@ -433,7 +438,7 @@ let WorkspaceTrustUXHandler = class WorkspaceTrustUXHandler extends Disposable {
|
|
|
433
438
|
});
|
|
434
439
|
}
|
|
435
440
|
getBannerItem(restrictedMode) {
|
|
436
|
-
const dismissedRestricted = this.storageService.getBoolean(BANNER_RESTRICTED_MODE_DISMISSED_KEY,
|
|
441
|
+
const dismissedRestricted = this.storageService.getBoolean(BANNER_RESTRICTED_MODE_DISMISSED_KEY, StorageScope.WORKSPACE, false);
|
|
437
442
|
if (this.bannerSetting === 'never') {
|
|
438
443
|
return undefined;
|
|
439
444
|
}
|
|
@@ -458,26 +463,26 @@ let WorkspaceTrustUXHandler = class WorkspaceTrustUXHandler extends Disposable {
|
|
|
458
463
|
actions,
|
|
459
464
|
onClose: () => {
|
|
460
465
|
if (restrictedMode) {
|
|
461
|
-
this.storageService.store(BANNER_RESTRICTED_MODE_DISMISSED_KEY, true,
|
|
466
|
+
this.storageService.store(BANNER_RESTRICTED_MODE_DISMISSED_KEY, true, StorageScope.WORKSPACE, StorageTarget.MACHINE);
|
|
462
467
|
}
|
|
463
468
|
}
|
|
464
469
|
};
|
|
465
470
|
}
|
|
466
471
|
getBannerItemAriaLabels() {
|
|
467
472
|
switch (this.workspaceContextService.getWorkbenchState()) {
|
|
468
|
-
case
|
|
473
|
+
case WorkbenchState.EMPTY:
|
|
469
474
|
return ( localizeWithPath(
|
|
470
475
|
_moduleId,
|
|
471
476
|
31,
|
|
472
477
|
"Restricted Mode is intended for safe code browsing. Trust this window to enable all features. Use navigation keys to access banner actions."
|
|
473
478
|
));
|
|
474
|
-
case
|
|
479
|
+
case WorkbenchState.FOLDER:
|
|
475
480
|
return ( localizeWithPath(
|
|
476
481
|
_moduleId,
|
|
477
482
|
32,
|
|
478
483
|
"Restricted Mode is intended for safe code browsing. Trust this folder to enable all features. Use navigation keys to access banner actions."
|
|
479
484
|
));
|
|
480
|
-
case
|
|
485
|
+
case WorkbenchState.WORKSPACE:
|
|
481
486
|
return ( localizeWithPath(
|
|
482
487
|
_moduleId,
|
|
483
488
|
33,
|
|
@@ -487,19 +492,19 @@ let WorkspaceTrustUXHandler = class WorkspaceTrustUXHandler extends Disposable {
|
|
|
487
492
|
}
|
|
488
493
|
getBannerItemMessages() {
|
|
489
494
|
switch (this.workspaceContextService.getWorkbenchState()) {
|
|
490
|
-
case
|
|
495
|
+
case WorkbenchState.EMPTY:
|
|
491
496
|
return ( localizeWithPath(
|
|
492
497
|
_moduleId,
|
|
493
498
|
34,
|
|
494
499
|
"Restricted Mode is intended for safe code browsing. Trust this window to enable all features."
|
|
495
500
|
));
|
|
496
|
-
case
|
|
501
|
+
case WorkbenchState.FOLDER:
|
|
497
502
|
return ( localizeWithPath(
|
|
498
503
|
_moduleId,
|
|
499
504
|
35,
|
|
500
505
|
"Restricted Mode is intended for safe code browsing. Trust this folder to enable all features."
|
|
501
506
|
));
|
|
502
|
-
case
|
|
507
|
+
case WorkbenchState.WORKSPACE:
|
|
503
508
|
return ( localizeWithPath(
|
|
504
509
|
_moduleId,
|
|
505
510
|
36,
|
|
@@ -518,7 +523,7 @@ let WorkspaceTrustUXHandler = class WorkspaceTrustUXHandler extends Disposable {
|
|
|
518
523
|
let ariaLabel = '';
|
|
519
524
|
let toolTip;
|
|
520
525
|
switch (this.workspaceContextService.getWorkbenchState()) {
|
|
521
|
-
case
|
|
526
|
+
case WorkbenchState.EMPTY: {
|
|
522
527
|
ariaLabel = ( localizeWithPath(
|
|
523
528
|
_moduleId,
|
|
524
529
|
37,
|
|
@@ -537,7 +542,7 @@ let WorkspaceTrustUXHandler = class WorkspaceTrustUXHandler extends Disposable {
|
|
|
537
542
|
};
|
|
538
543
|
break;
|
|
539
544
|
}
|
|
540
|
-
case
|
|
545
|
+
case WorkbenchState.FOLDER: {
|
|
541
546
|
ariaLabel = ( localizeWithPath(
|
|
542
547
|
_moduleId,
|
|
543
548
|
39,
|
|
@@ -556,7 +561,7 @@ let WorkspaceTrustUXHandler = class WorkspaceTrustUXHandler extends Disposable {
|
|
|
556
561
|
};
|
|
557
562
|
break;
|
|
558
563
|
}
|
|
559
|
-
case
|
|
564
|
+
case WorkbenchState.WORKSPACE: {
|
|
560
565
|
ariaLabel = ( localizeWithPath(
|
|
561
566
|
_moduleId,
|
|
562
567
|
41,
|
|
@@ -592,7 +597,7 @@ let WorkspaceTrustUXHandler = class WorkspaceTrustUXHandler extends Disposable {
|
|
|
592
597
|
}
|
|
593
598
|
if (!trusted && !this.statusbarEntryAccessor.value) {
|
|
594
599
|
const entry = this.getRestrictedModeStatusbarEntry();
|
|
595
|
-
this.statusbarEntryAccessor.value = this.statusbarService.addEntry(entry, this.entryId,
|
|
600
|
+
this.statusbarEntryAccessor.value = this.statusbarService.addEntry(entry, this.entryId, StatusbarAlignment.LEFT, 0.99 * Number.MAX_VALUE );
|
|
596
601
|
}
|
|
597
602
|
}
|
|
598
603
|
};
|
|
@@ -613,8 +618,8 @@ WorkspaceTrustUXHandler = ( (__decorate([
|
|
|
613
618
|
( (__param(13, IEnvironmentService))),
|
|
614
619
|
( (__param(14, IFileService)))
|
|
615
620
|
], WorkspaceTrustUXHandler)));
|
|
616
|
-
registerWorkbenchContribution2(WorkspaceTrustRequestHandler.ID, WorkspaceTrustRequestHandler,
|
|
617
|
-
( (Registry.as(Extensions.Workbench))).registerWorkbenchContribution(WorkspaceTrustUXHandler,
|
|
621
|
+
registerWorkbenchContribution2(WorkspaceTrustRequestHandler.ID, WorkspaceTrustRequestHandler, WorkbenchPhase.BlockRestore);
|
|
622
|
+
( (Registry.as(Extensions.Workbench))).registerWorkbenchContribution(WorkspaceTrustUXHandler, LifecyclePhase.Restored);
|
|
618
623
|
class WorkspaceTrustEditorInputSerializer {
|
|
619
624
|
canSerialize(editorInput) {
|
|
620
625
|
return true;
|
|
@@ -684,7 +689,7 @@ registerAction2(class extends Action2 {
|
|
|
684
689
|
"Controls whether or not Workspace Trust is enabled within VS Code."
|
|
685
690
|
)),
|
|
686
691
|
tags: [WORKSPACE_TRUST_SETTING_TAG],
|
|
687
|
-
scope:
|
|
692
|
+
scope: ConfigurationScope.APPLICATION,
|
|
688
693
|
},
|
|
689
694
|
[WORKSPACE_TRUST_STARTUP_PROMPT]: {
|
|
690
695
|
type: 'string',
|
|
@@ -695,7 +700,7 @@ registerAction2(class extends Action2 {
|
|
|
695
700
|
"Controls when the startup prompt to trust a workspace is shown."
|
|
696
701
|
)),
|
|
697
702
|
tags: [WORKSPACE_TRUST_SETTING_TAG],
|
|
698
|
-
scope:
|
|
703
|
+
scope: ConfigurationScope.APPLICATION,
|
|
699
704
|
enum: ['always', 'once', 'never'],
|
|
700
705
|
enumDescriptions: [
|
|
701
706
|
( localizeWithPath(
|
|
@@ -720,7 +725,7 @@ registerAction2(class extends Action2 {
|
|
|
720
725
|
default: 'untilDismissed',
|
|
721
726
|
description: ( localizeWithPath(_moduleId, 54, "Controls when the restricted mode banner is shown.")),
|
|
722
727
|
tags: [WORKSPACE_TRUST_SETTING_TAG],
|
|
723
|
-
scope:
|
|
728
|
+
scope: ConfigurationScope.APPLICATION,
|
|
724
729
|
enum: ['always', 'untilDismissed', 'never'],
|
|
725
730
|
enumDescriptions: [
|
|
726
731
|
( localizeWithPath(
|
|
@@ -750,7 +755,7 @@ registerAction2(class extends Action2 {
|
|
|
750
755
|
WORKSPACE_TRUST_EMPTY_WINDOW
|
|
751
756
|
)),
|
|
752
757
|
tags: [WORKSPACE_TRUST_SETTING_TAG],
|
|
753
|
-
scope:
|
|
758
|
+
scope: ConfigurationScope.APPLICATION,
|
|
754
759
|
enum: ['prompt', 'open', 'newWindow'],
|
|
755
760
|
enumDescriptions: [
|
|
756
761
|
( localizeWithPath(
|
|
@@ -780,7 +785,7 @@ registerAction2(class extends Action2 {
|
|
|
780
785
|
WORKSPACE_TRUST_UNTRUSTED_FILES
|
|
781
786
|
)),
|
|
782
787
|
tags: [WORKSPACE_TRUST_SETTING_TAG],
|
|
783
|
-
scope:
|
|
788
|
+
scope: ConfigurationScope.APPLICATION
|
|
784
789
|
}
|
|
785
790
|
}
|
|
786
791
|
});
|
|
@@ -850,6 +855,6 @@ WorkspaceTrustTelemetryContribution = ( (__decorate([
|
|
|
850
855
|
( (__param(4, IWorkspaceTrustManagementService)))
|
|
851
856
|
], WorkspaceTrustTelemetryContribution)));
|
|
852
857
|
( (Registry.as(Extensions.Workbench)))
|
|
853
|
-
.registerWorkbenchContribution(WorkspaceTrustTelemetryContribution,
|
|
858
|
+
.registerWorkbenchContribution(WorkspaceTrustTelemetryContribution, LifecyclePhase.Restored);
|
|
854
859
|
|
|
855
860
|
export { WorkspaceTrustContextKeys, WorkspaceTrustRequestHandler, WorkspaceTrustUXHandler };
|
|
@@ -2,19 +2,21 @@ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
|
2
2
|
import { $, addDisposableListener, EventType, EventHelper, addStandardDisposableListener, clearNode, append, isAncestorOfActiveElement } from 'vscode/vscode/vs/base/browser/dom';
|
|
3
3
|
import { ActionBar } from 'vscode/vscode/vs/base/browser/ui/actionbar/actionbar';
|
|
4
4
|
import { ButtonBar } from 'vscode/vscode/vs/base/browser/ui/button/button';
|
|
5
|
-
import { InputBox } from 'vscode/vscode/vs/base/browser/ui/inputbox/inputBox';
|
|
5
|
+
import { MessageType, InputBox } from 'vscode/vscode/vs/base/browser/ui/inputbox/inputBox';
|
|
6
6
|
import { DomScrollableElement } from 'vscode/vscode/vs/base/browser/ui/scrollbar/scrollableElement';
|
|
7
7
|
import { Action } from 'vscode/vscode/vs/base/common/actions';
|
|
8
8
|
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
9
9
|
import { debounce } from 'vscode/vscode/vs/base/common/decorators';
|
|
10
10
|
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
11
|
+
import { KeyCode, KeyMod } from 'vscode/vscode/vs/base/common/keyCodes';
|
|
11
12
|
import { normalizeDriveLetter } from 'vscode/vscode/vs/base/common/labels';
|
|
12
13
|
import { Disposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
13
14
|
import { parseLinkedText } from 'vscode/vscode/vs/base/common/linkedText';
|
|
14
15
|
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
16
|
+
import { ScrollbarVisibility } from 'vscode/vscode/vs/base/common/scrollable';
|
|
15
17
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
16
18
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
17
|
-
import { Extensions } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
|
|
19
|
+
import { Extensions, ConfigurationScope } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
|
|
18
20
|
import { IContextViewService } from 'vscode/vscode/vs/platform/contextview/browser/contextView.service';
|
|
19
21
|
import { IFileDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
20
22
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
@@ -36,7 +38,7 @@ import 'vscode/vscode/vs/platform/theme/common/colors/minimapColors';
|
|
|
36
38
|
import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
|
|
37
39
|
import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
|
|
38
40
|
import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
|
|
39
|
-
import { toWorkspaceIdentifier } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
41
|
+
import { WorkbenchState, toWorkspaceIdentifier } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
40
42
|
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
|
|
41
43
|
import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService.service';
|
|
42
44
|
import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
|
|
@@ -49,6 +51,7 @@ import { IWorkbenchConfigurationService } from 'vscode/vscode/vs/workbench/servi
|
|
|
49
51
|
import { IExtensionManifestPropertiesService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensionManifestPropertiesService.service';
|
|
50
52
|
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
51
53
|
import { getExtensionDependencies } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagementUtil';
|
|
54
|
+
import { EnablementState } from 'vscode/vscode/vs/workbench/services/extensionManagement/common/extensionManagement';
|
|
52
55
|
import { IWorkbenchExtensionEnablementService } from 'vscode/vscode/vs/workbench/services/extensionManagement/common/extensionManagement.service';
|
|
53
56
|
import { posix, win32 } from 'vscode/vscode/vs/base/common/path';
|
|
54
57
|
import { hasDriveLetter, toSlashes } from 'vscode/vscode/vs/base/common/extpath';
|
|
@@ -270,7 +273,7 @@ let WorkspaceTrustedUrisTable = class WorkspaceTrustedUrisTable extends Disposab
|
|
|
270
273
|
const segments = path.split(posix.sep).filter(s => s.length);
|
|
271
274
|
if (segments.length === 0 && path.startsWith(posix.sep)) {
|
|
272
275
|
return {
|
|
273
|
-
type:
|
|
276
|
+
type: MessageType.WARNING,
|
|
274
277
|
content: ( localizeWithPath(
|
|
275
278
|
_moduleId,
|
|
276
279
|
16,
|
|
@@ -281,7 +284,7 @@ let WorkspaceTrustedUrisTable = class WorkspaceTrustedUrisTable extends Disposab
|
|
|
281
284
|
}
|
|
282
285
|
if (segments.length === 1) {
|
|
283
286
|
return {
|
|
284
|
-
type:
|
|
287
|
+
type: MessageType.WARNING,
|
|
285
288
|
content: ( localizeWithPath(
|
|
286
289
|
_moduleId,
|
|
287
290
|
17,
|
|
@@ -293,7 +296,7 @@ let WorkspaceTrustedUrisTable = class WorkspaceTrustedUrisTable extends Disposab
|
|
|
293
296
|
}
|
|
294
297
|
if (segments.length > 2) {
|
|
295
298
|
return {
|
|
296
|
-
type:
|
|
299
|
+
type: MessageType.ERROR,
|
|
297
300
|
content: ( localizeWithPath(
|
|
298
301
|
_moduleId,
|
|
299
302
|
18,
|
|
@@ -404,6 +407,7 @@ let TrustedUriActionsColumnRenderer = class TrustedUriActionsColumnRenderer {
|
|
|
404
407
|
}
|
|
405
408
|
createEditAction(item) {
|
|
406
409
|
return {
|
|
410
|
+
label: '',
|
|
407
411
|
class: ThemeIcon.asClassName(editIcon),
|
|
408
412
|
enabled: true,
|
|
409
413
|
id: 'editTrustedUri',
|
|
@@ -415,6 +419,7 @@ let TrustedUriActionsColumnRenderer = class TrustedUriActionsColumnRenderer {
|
|
|
415
419
|
}
|
|
416
420
|
createPickerAction(item) {
|
|
417
421
|
return {
|
|
422
|
+
label: '',
|
|
418
423
|
class: ThemeIcon.asClassName(folderPickerIcon),
|
|
419
424
|
enabled: true,
|
|
420
425
|
id: 'pickerTrustedUri',
|
|
@@ -426,6 +431,7 @@ let TrustedUriActionsColumnRenderer = class TrustedUriActionsColumnRenderer {
|
|
|
426
431
|
}
|
|
427
432
|
createDeleteAction(item) {
|
|
428
433
|
return {
|
|
434
|
+
label: '',
|
|
429
435
|
class: ThemeIcon.asClassName(removeIcon),
|
|
430
436
|
enabled: true,
|
|
431
437
|
id: 'deleteTrustedUri',
|
|
@@ -503,11 +509,11 @@ let TrustedUriPathColumnRenderer = class TrustedUriPathColumnRenderer {
|
|
|
503
509
|
};
|
|
504
510
|
templateData.renderDisposables.add(addStandardDisposableListener(templateData.pathInput.inputElement, EventType.KEY_DOWN, e => {
|
|
505
511
|
let handled = false;
|
|
506
|
-
if (e.equals(
|
|
512
|
+
if (e.equals(KeyCode.Enter)) {
|
|
507
513
|
accept();
|
|
508
514
|
handled = true;
|
|
509
515
|
}
|
|
510
|
-
else if (e.equals(
|
|
516
|
+
else if (e.equals(KeyCode.Escape)) {
|
|
511
517
|
reject();
|
|
512
518
|
handled = true;
|
|
513
519
|
}
|
|
@@ -607,8 +613,8 @@ let WorkspaceTrustEditor = class WorkspaceTrustEditor extends EditorPane {
|
|
|
607
613
|
this.createHeaderElement(this.rootElement);
|
|
608
614
|
const scrollableContent = $('.workspace-trust-editor-body');
|
|
609
615
|
this.bodyScrollBar = this._register(( (new DomScrollableElement(scrollableContent, {
|
|
610
|
-
horizontal:
|
|
611
|
-
vertical:
|
|
616
|
+
horizontal: ScrollbarVisibility.Hidden,
|
|
617
|
+
vertical: ScrollbarVisibility.Auto,
|
|
612
618
|
}))));
|
|
613
619
|
append(this.rootElement, this.bodyScrollBar.getDomNode());
|
|
614
620
|
this.createAffectedFeaturesElement(scrollableContent);
|
|
@@ -619,16 +625,16 @@ let WorkspaceTrustEditor = class WorkspaceTrustEditor extends EditorPane {
|
|
|
619
625
|
this.rootElement.style.setProperty('--workspace-trust-x-color', asCssVariable(editorErrorForeground));
|
|
620
626
|
this._register(addDisposableListener(this.rootElement, EventType.KEY_DOWN, e => {
|
|
621
627
|
const event = ( (new StandardKeyboardEvent(e)));
|
|
622
|
-
if (event.equals(
|
|
628
|
+
if (event.equals(KeyCode.UpArrow) || event.equals(KeyCode.DownArrow)) {
|
|
623
629
|
const navOrder = [this.headerContainer, this.trustedContainer, this.untrustedContainer, this.configurationContainer];
|
|
624
630
|
const currentIndex = navOrder.findIndex(element => {
|
|
625
631
|
return isAncestorOfActiveElement(element);
|
|
626
632
|
});
|
|
627
633
|
let newIndex = currentIndex;
|
|
628
|
-
if (event.equals(
|
|
634
|
+
if (event.equals(KeyCode.DownArrow)) {
|
|
629
635
|
newIndex++;
|
|
630
636
|
}
|
|
631
|
-
else if (event.equals(
|
|
637
|
+
else if (event.equals(KeyCode.UpArrow)) {
|
|
632
638
|
newIndex = Math.max(0, newIndex);
|
|
633
639
|
newIndex--;
|
|
634
640
|
}
|
|
@@ -636,15 +642,15 @@ let WorkspaceTrustEditor = class WorkspaceTrustEditor extends EditorPane {
|
|
|
636
642
|
newIndex %= navOrder.length;
|
|
637
643
|
navOrder[newIndex].focus();
|
|
638
644
|
}
|
|
639
|
-
else if (event.equals(
|
|
645
|
+
else if (event.equals(KeyCode.Escape)) {
|
|
640
646
|
this.rootElement.focus();
|
|
641
647
|
}
|
|
642
|
-
else if (event.equals(
|
|
648
|
+
else if (event.equals(KeyMod.CtrlCmd | KeyCode.Enter)) {
|
|
643
649
|
if (this.workspaceTrustManagementService.canSetWorkspaceTrust()) {
|
|
644
650
|
this.workspaceTrustManagementService.setWorkspaceTrust(!this.workspaceTrustManagementService.isWorkspaceTrusted());
|
|
645
651
|
}
|
|
646
652
|
}
|
|
647
|
-
else if (event.equals(
|
|
653
|
+
else if (event.equals(KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Enter)) {
|
|
648
654
|
if (this.workspaceTrustManagementService.canSetParentFolderTrust()) {
|
|
649
655
|
this.workspaceTrustManagementService.setParentFolderTrust(true);
|
|
650
656
|
}
|
|
@@ -682,11 +688,11 @@ let WorkspaceTrustEditor = class WorkspaceTrustEditor extends EditorPane {
|
|
|
682
688
|
return ( localizeWithPath(_moduleId, 23, "This window is trusted"));
|
|
683
689
|
}
|
|
684
690
|
switch (this.workspaceService.getWorkbenchState()) {
|
|
685
|
-
case
|
|
691
|
+
case WorkbenchState.EMPTY:
|
|
686
692
|
return ( localizeWithPath(_moduleId, 24, "You trust this window"));
|
|
687
|
-
case
|
|
693
|
+
case WorkbenchState.FOLDER:
|
|
688
694
|
return ( localizeWithPath(_moduleId, 25, "You trust this folder"));
|
|
689
|
-
case
|
|
695
|
+
case WorkbenchState.WORKSPACE:
|
|
690
696
|
return ( localizeWithPath(_moduleId, 26, "You trust this workspace"));
|
|
691
697
|
}
|
|
692
698
|
}
|
|
@@ -699,7 +705,7 @@ let WorkspaceTrustEditor = class WorkspaceTrustEditor extends EditorPane {
|
|
|
699
705
|
let title = '';
|
|
700
706
|
let subTitle = '';
|
|
701
707
|
switch (this.workspaceService.getWorkbenchState()) {
|
|
702
|
-
case
|
|
708
|
+
case WorkbenchState.EMPTY: {
|
|
703
709
|
title = trusted ? ( localizeWithPath(_moduleId, 28, "In a Trusted Window")) : ( localizeWithPath(_moduleId, 29, "In Restricted Mode"));
|
|
704
710
|
subTitle = trusted ? ( localizeWithPath(
|
|
705
711
|
_moduleId,
|
|
@@ -713,7 +719,7 @@ let WorkspaceTrustEditor = class WorkspaceTrustEditor extends EditorPane {
|
|
|
713
719
|
));
|
|
714
720
|
break;
|
|
715
721
|
}
|
|
716
|
-
case
|
|
722
|
+
case WorkbenchState.FOLDER: {
|
|
717
723
|
title = trusted ? ( localizeWithPath(_moduleId, 32, "In a Trusted Folder")) : ( localizeWithPath(_moduleId, 29, "In Restricted Mode"));
|
|
718
724
|
subTitle = trusted ? ( localizeWithPath(
|
|
719
725
|
_moduleId,
|
|
@@ -727,7 +733,7 @@ let WorkspaceTrustEditor = class WorkspaceTrustEditor extends EditorPane {
|
|
|
727
733
|
));
|
|
728
734
|
break;
|
|
729
735
|
}
|
|
730
|
-
case
|
|
736
|
+
case WorkbenchState.WORKSPACE: {
|
|
731
737
|
title = trusted ? ( localizeWithPath(_moduleId, 35, "In a Trusted Workspace")) : ( localizeWithPath(_moduleId, 29, "In Restricted Mode"));
|
|
732
738
|
subTitle = trusted ? ( localizeWithPath(
|
|
733
739
|
_moduleId,
|
|
@@ -791,7 +797,7 @@ let WorkspaceTrustEditor = class WorkspaceTrustEditor extends EditorPane {
|
|
|
791
797
|
const configurationRegistry = ( (Registry.as(Extensions.Configuration)));
|
|
792
798
|
const settingsRequiringTrustedWorkspaceCount = restrictedSettings.default.filter(key => {
|
|
793
799
|
const property = configurationRegistry.getConfigurationProperties()[key];
|
|
794
|
-
if (property.scope ===
|
|
800
|
+
if (property.scope === ConfigurationScope.APPLICATION || property.scope === ConfigurationScope.MACHINE) {
|
|
795
801
|
return false;
|
|
796
802
|
}
|
|
797
803
|
if (property.deprecationMessage || property.markdownDeprecationMessage) {
|
|
@@ -821,8 +827,8 @@ let WorkspaceTrustEditor = class WorkspaceTrustEditor extends EditorPane {
|
|
|
821
827
|
const localExtensions = ( (this.extensionWorkbenchService.local.filter(ext => ext.local).map(ext => ext.local)));
|
|
822
828
|
for (const extension of localExtensions) {
|
|
823
829
|
const enablementState = this.extensionEnablementService.getEnablementState(extension);
|
|
824
|
-
if (enablementState !==
|
|
825
|
-
enablementState !==
|
|
830
|
+
if (enablementState !== EnablementState.EnabledGlobally && enablementState !== EnablementState.EnabledWorkspace &&
|
|
831
|
+
enablementState !== EnablementState.DisabledByTrustRequirement && enablementState !== EnablementState.DisabledByExtensionDependency) {
|
|
826
832
|
continue;
|
|
827
833
|
}
|
|
828
834
|
if (inVirtualWorkspace && this.extensionManifestPropertiesService.getExtensionVirtualWorkspaceSupportType(extension.manifest) === false) {
|
|
@@ -864,7 +870,7 @@ let WorkspaceTrustEditor = class WorkspaceTrustEditor extends EditorPane {
|
|
|
864
870
|
clearNode(this.untrustedContainer);
|
|
865
871
|
const [trustedTitle, trustedSubTitle] = this.getFeaturesHeaderText(true);
|
|
866
872
|
this.renderLimitationsHeaderElement(this.trustedContainer, trustedTitle, trustedSubTitle);
|
|
867
|
-
const trustedContainerItems = this.workspaceService.getWorkbenchState() ===
|
|
873
|
+
const trustedContainerItems = this.workspaceService.getWorkbenchState() === WorkbenchState.EMPTY ?
|
|
868
874
|
[
|
|
869
875
|
( localizeWithPath(_moduleId, 42, "Tasks are allowed to run")),
|
|
870
876
|
( localizeWithPath(_moduleId, 43, "Debugging is enabled")),
|
|
@@ -879,7 +885,7 @@ let WorkspaceTrustEditor = class WorkspaceTrustEditor extends EditorPane {
|
|
|
879
885
|
this.renderLimitationsListElement(this.trustedContainer, trustedContainerItems, ThemeIcon.asClassNameArray(checkListIcon));
|
|
880
886
|
const [untrustedTitle, untrustedSubTitle] = this.getFeaturesHeaderText(false);
|
|
881
887
|
this.renderLimitationsHeaderElement(this.untrustedContainer, untrustedTitle, untrustedSubTitle);
|
|
882
|
-
const untrustedContainerItems = this.workspaceService.getWorkbenchState() ===
|
|
888
|
+
const untrustedContainerItems = this.workspaceService.getWorkbenchState() === WorkbenchState.EMPTY ?
|
|
883
889
|
[
|
|
884
890
|
( localizeWithPath(_moduleId, 46, "Tasks are not allowed to run")),
|
|
885
891
|
( localizeWithPath(_moduleId, 47, "Debugging is disabled")),
|
|
@@ -973,12 +979,12 @@ let WorkspaceTrustEditor = class WorkspaceTrustEditor extends EditorPane {
|
|
|
973
979
|
}]);
|
|
974
980
|
}
|
|
975
981
|
addTrustedTextToElement(parent) {
|
|
976
|
-
if (this.workspaceService.getWorkbenchState() ===
|
|
982
|
+
if (this.workspaceService.getWorkbenchState() === WorkbenchState.EMPTY) {
|
|
977
983
|
return;
|
|
978
984
|
}
|
|
979
985
|
const textElement = append(parent, $('.workspace-trust-untrusted-description'));
|
|
980
986
|
if (!this.workspaceTrustManagementService.isWorkspaceTrustForced()) {
|
|
981
|
-
textElement.innerText = this.workspaceService.getWorkbenchState() ===
|
|
987
|
+
textElement.innerText = this.workspaceService.getWorkbenchState() === WorkbenchState.WORKSPACE ? ( localizeWithPath(
|
|
982
988
|
_moduleId,
|
|
983
989
|
56,
|
|
984
990
|
"This workspace is trusted via the bolded entries in the trusted folders below."
|
|
@@ -3,6 +3,7 @@ import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
|
3
3
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
4
4
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
5
5
|
import { registerIcon } from 'vscode/vscode/vs/platform/theme/common/iconRegistry';
|
|
6
|
+
import { EditorInputCapabilities } from 'vscode/vscode/vs/workbench/common/editor';
|
|
6
7
|
import { EditorInput } from 'vscode/vscode/vs/workbench/common/editor/editorInput';
|
|
7
8
|
|
|
8
9
|
const _moduleId = "vs/workbench/services/workspaces/browser/workspaceTrustEditorInput";
|
|
@@ -17,7 +18,7 @@ class WorkspaceTrustEditorInput extends EditorInput {
|
|
|
17
18
|
}
|
|
18
19
|
static { this.ID = 'workbench.input.workspaceTrust'; }
|
|
19
20
|
get capabilities() {
|
|
20
|
-
return
|
|
21
|
+
return EditorInputCapabilities.Readonly | EditorInputCapabilities.Singleton;
|
|
21
22
|
}
|
|
22
23
|
get typeId() {
|
|
23
24
|
return WorkspaceTrustEditorInput.ID;
|