@codingame/monaco-vscode-quickaccess-service-override 25.1.2 → 26.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 +2 -2
- package/vscode/src/vs/platform/quickinput/browser/commandsQuickAccess.js +121 -73
- package/vscode/src/vs/platform/quickinput/browser/helpQuickAccess.d.ts +3 -1
- package/vscode/src/vs/platform/quickinput/browser/helpQuickAccess.js +24 -17
- package/vscode/src/vs/workbench/browser/actions/quickAccessActions.js +63 -35
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoLineQuickAccess.js +22 -15
- package/vscode/src/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.js +82 -77
- package/vscode/src/vs/workbench/contrib/quickaccess/browser/quickAccess.contribution.js +34 -27
- package/vscode/src/vs/workbench/contrib/quickaccess/browser/viewQuickAccess.js +63 -38
- package/vscode/src/vs/workbench/contrib/url/browser/externalUriResolver.js +6 -8
- package/vscode/src/vs/workbench/contrib/url/browser/trustedDomainsFileSystemProvider.js +27 -23
- package/vscode/src/vs/workbench/contrib/url/browser/trustedDomainsValidator.js +67 -56
- package/vscode/src/vs/workbench/contrib/url/browser/url.contribution.js +30 -12
- package/vscode/src/vs/workbench/services/quickinput/browser/quickInputService.js +18 -12
|
@@ -17,76 +17,83 @@ quickAccessRegistry.registerQuickAccessProvider({
|
|
|
17
17
|
ctor: HelpQuickAccessProvider,
|
|
18
18
|
prefix: HelpQuickAccessProvider.PREFIX,
|
|
19
19
|
placeholder: ( localize(
|
|
20
|
-
|
|
20
|
+
10518,
|
|
21
21
|
"Type '{0}' to get help on the actions you can take from here.",
|
|
22
22
|
HelpQuickAccessProvider.PREFIX
|
|
23
23
|
)),
|
|
24
24
|
helpEntries: [{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
description: ( localize(10519, "Show all Quick Access Providers")),
|
|
26
|
+
commandCenterOrder: 70,
|
|
27
|
+
commandCenterLabel: ( localize(10520, "More"))
|
|
28
|
+
}]
|
|
29
29
|
});
|
|
30
30
|
quickAccessRegistry.registerQuickAccessProvider({
|
|
31
31
|
ctor: ViewQuickAccessProvider,
|
|
32
32
|
prefix: ViewQuickAccessProvider.PREFIX,
|
|
33
|
-
contextKey:
|
|
34
|
-
placeholder: ( localize(
|
|
35
|
-
helpEntries: [{
|
|
33
|
+
contextKey: "inViewsPicker",
|
|
34
|
+
placeholder: ( localize(10521, "Type the name of a view, output channel or terminal to open.")),
|
|
35
|
+
helpEntries: [{
|
|
36
|
+
description: ( localize(10522, "Open View")),
|
|
37
|
+
commandId: OpenViewPickerAction.ID
|
|
38
|
+
}]
|
|
36
39
|
});
|
|
37
40
|
quickAccessRegistry.registerQuickAccessProvider({
|
|
38
41
|
ctor: CommandsQuickAccessProvider,
|
|
39
42
|
prefix: CommandsQuickAccessProvider.PREFIX,
|
|
40
|
-
contextKey:
|
|
41
|
-
placeholder: ( localize(
|
|
42
|
-
helpEntries: [{
|
|
43
|
+
contextKey: "inCommandsPicker",
|
|
44
|
+
placeholder: ( localize(10523, "Type the name of a command to run.")),
|
|
45
|
+
helpEntries: [{
|
|
46
|
+
description: ( localize(10524, "Show and Run Commands")),
|
|
47
|
+
commandId: ShowAllCommandsAction.ID,
|
|
48
|
+
commandCenterOrder: 20
|
|
49
|
+
}]
|
|
43
50
|
});
|
|
44
51
|
MenuRegistry.appendMenuItem(MenuId.MenubarViewMenu, {
|
|
45
|
-
group:
|
|
52
|
+
group: "1_open",
|
|
46
53
|
command: {
|
|
47
54
|
id: ShowAllCommandsAction.ID,
|
|
48
|
-
title: ( localize(
|
|
55
|
+
title: ( localize(10525, "&&Command Palette..."))
|
|
49
56
|
},
|
|
50
57
|
order: 1
|
|
51
58
|
});
|
|
52
59
|
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
|
|
53
|
-
group:
|
|
60
|
+
group: "1_welcome",
|
|
54
61
|
command: {
|
|
55
62
|
id: ShowAllCommandsAction.ID,
|
|
56
|
-
title: ( localize(
|
|
63
|
+
title: ( localize(10526, "Show All Commands"))
|
|
57
64
|
},
|
|
58
65
|
order: 2
|
|
59
66
|
});
|
|
60
67
|
MenuRegistry.appendMenuItem(MenuId.MenubarViewMenu, {
|
|
61
|
-
group:
|
|
68
|
+
group: "1_open",
|
|
62
69
|
command: {
|
|
63
70
|
id: OpenViewPickerAction.ID,
|
|
64
|
-
title: ( localize(
|
|
71
|
+
title: ( localize(10527, "&&Open View..."))
|
|
65
72
|
},
|
|
66
73
|
order: 2
|
|
67
74
|
});
|
|
68
75
|
MenuRegistry.appendMenuItem(MenuId.MenubarGoMenu, {
|
|
69
|
-
group:
|
|
76
|
+
group: "5_infile_nav",
|
|
70
77
|
command: {
|
|
71
|
-
id:
|
|
72
|
-
title: ( localize(
|
|
78
|
+
id: "workbench.action.gotoLine",
|
|
79
|
+
title: ( localize(10528, "Go to &&Line/Column..."))
|
|
73
80
|
},
|
|
74
81
|
order: 1
|
|
75
82
|
});
|
|
76
83
|
MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
|
|
77
|
-
group:
|
|
84
|
+
group: "1_command",
|
|
78
85
|
command: {
|
|
79
86
|
id: ShowAllCommandsAction.ID,
|
|
80
|
-
title: ( localize(
|
|
87
|
+
title: ( localize(10529, "Command Palette..."))
|
|
81
88
|
},
|
|
82
89
|
order: 1
|
|
83
90
|
});
|
|
84
91
|
MenuRegistry.appendMenuItem(MenuId.EditorContext, {
|
|
85
|
-
group:
|
|
92
|
+
group: "z_commands",
|
|
86
93
|
when: ( EditorContextKeys.editorSimpleInput.toNegated()),
|
|
87
94
|
command: {
|
|
88
95
|
id: ShowAllCommandsAction.ID,
|
|
89
|
-
title: ( localize(
|
|
96
|
+
title: ( localize(10529, "Command Palette..."))
|
|
90
97
|
},
|
|
91
98
|
order: 1
|
|
92
99
|
});
|
|
@@ -94,10 +101,10 @@ registerAction2(ClearCommandHistoryAction);
|
|
|
94
101
|
registerAction2(ShowAllCommandsAction);
|
|
95
102
|
registerAction2(OpenViewPickerAction);
|
|
96
103
|
registerAction2(QuickAccessViewPickerAction);
|
|
97
|
-
const inViewsPickerContextKey =
|
|
104
|
+
const inViewsPickerContextKey = "inViewsPicker";
|
|
98
105
|
const inViewsPickerContext = ( ContextKeyExpr.and(inQuickPickContext, ( ContextKeyExpr.has(inViewsPickerContextKey))));
|
|
99
106
|
const viewPickerKeybinding = QuickAccessViewPickerAction.KEYBINDING;
|
|
100
|
-
const quickAccessNavigateNextInViewPickerId =
|
|
107
|
+
const quickAccessNavigateNextInViewPickerId = "workbench.action.quickOpenNavigateNextInViewPicker";
|
|
101
108
|
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
102
109
|
id: quickAccessNavigateNextInViewPickerId,
|
|
103
110
|
weight: KeybindingWeight.WorkbenchContrib + 50,
|
|
@@ -107,7 +114,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
|
107
114
|
linux: viewPickerKeybinding.linux,
|
|
108
115
|
mac: viewPickerKeybinding.mac
|
|
109
116
|
});
|
|
110
|
-
const quickAccessNavigatePreviousInViewPickerId =
|
|
117
|
+
const quickAccessNavigatePreviousInViewPickerId = "workbench.action.quickOpenNavigatePreviousInViewPicker";
|
|
111
118
|
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
112
119
|
id: quickAccessNavigatePreviousInViewPickerId,
|
|
113
120
|
weight: KeybindingWeight.WorkbenchContrib + 50,
|
|
@@ -23,13 +23,26 @@ import { IDebugService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/
|
|
|
23
23
|
|
|
24
24
|
var ViewQuickAccessProvider_1;
|
|
25
25
|
let ViewQuickAccessProvider = class ViewQuickAccessProvider extends PickerQuickAccessProvider {
|
|
26
|
-
static {
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
static {
|
|
27
|
+
ViewQuickAccessProvider_1 = this;
|
|
28
|
+
}
|
|
29
|
+
static {
|
|
30
|
+
this.PREFIX = "view ";
|
|
31
|
+
}
|
|
32
|
+
constructor(
|
|
33
|
+
viewDescriptorService,
|
|
34
|
+
viewsService,
|
|
35
|
+
outputService,
|
|
36
|
+
terminalService,
|
|
37
|
+
terminalGroupService,
|
|
38
|
+
debugService,
|
|
39
|
+
paneCompositeService,
|
|
40
|
+
contextKeyService
|
|
41
|
+
) {
|
|
29
42
|
super(ViewQuickAccessProvider_1.PREFIX, {
|
|
30
43
|
noResultsPick: {
|
|
31
|
-
label: ( localize(
|
|
32
|
-
containerLabel:
|
|
44
|
+
label: ( localize(10530, "No matching views")),
|
|
45
|
+
containerLabel: ""
|
|
33
46
|
}
|
|
34
47
|
});
|
|
35
48
|
this.viewDescriptorService = viewDescriptorService;
|
|
@@ -46,7 +59,9 @@ let ViewQuickAccessProvider = class ViewQuickAccessProvider extends PickerQuickA
|
|
|
46
59
|
if (!filter) {
|
|
47
60
|
return true;
|
|
48
61
|
}
|
|
49
|
-
entry.highlights = {
|
|
62
|
+
entry.highlights = {
|
|
63
|
+
label: matchesFuzzy(filter, entry.label, true) ?? undefined
|
|
64
|
+
};
|
|
50
65
|
return entry.highlights.label || fuzzyContains(entry.containerLabel, filter);
|
|
51
66
|
});
|
|
52
67
|
const mapEntryToContainer = ( new Map());
|
|
@@ -63,11 +78,13 @@ let ViewQuickAccessProvider = class ViewQuickAccessProvider extends PickerQuickA
|
|
|
63
78
|
let separatorLabel;
|
|
64
79
|
if (( mapEntryToContainer.has(lastContainer))) {
|
|
65
80
|
separatorLabel = `${mapEntryToContainer.get(lastContainer)} / ${lastContainer}`;
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
81
|
+
} else {
|
|
68
82
|
separatorLabel = lastContainer;
|
|
69
83
|
}
|
|
70
|
-
filteredViewEntriesWithSeparators.push({
|
|
84
|
+
filteredViewEntriesWithSeparators.push({
|
|
85
|
+
type: "separator",
|
|
86
|
+
label: separatorLabel
|
|
87
|
+
});
|
|
71
88
|
}
|
|
72
89
|
filteredViewEntriesWithSeparators.push(entry);
|
|
73
90
|
}
|
|
@@ -116,10 +133,10 @@ let ViewQuickAccessProvider = class ViewQuickAccessProvider extends PickerQuickA
|
|
|
116
133
|
}
|
|
117
134
|
}
|
|
118
135
|
};
|
|
119
|
-
addPaneComposites(ViewContainerLocation.Sidebar, ( localize(
|
|
120
|
-
addPaneComposites(ViewContainerLocation.Panel, ( localize(
|
|
121
|
-
addPaneComposites(ViewContainerLocation.AuxiliaryBar, ( localize(
|
|
122
|
-
const addPaneCompositeViews =
|
|
136
|
+
addPaneComposites(ViewContainerLocation.Sidebar, ( localize(10531, "Side Bar")));
|
|
137
|
+
addPaneComposites(ViewContainerLocation.Panel, ( localize(10532, "Panel")));
|
|
138
|
+
addPaneComposites(ViewContainerLocation.AuxiliaryBar, ( localize(10533, "Secondary Side Bar")));
|
|
139
|
+
const addPaneCompositeViews = location => {
|
|
123
140
|
const paneComposites = this.paneCompositeService.getPaneComposites(location);
|
|
124
141
|
for (const paneComposite of paneComposites) {
|
|
125
142
|
const viewContainer = this.viewDescriptorService.getViewContainerById(paneComposite.id);
|
|
@@ -134,14 +151,14 @@ let ViewQuickAccessProvider = class ViewQuickAccessProvider extends PickerQuickA
|
|
|
134
151
|
this.terminalGroupService.groups.forEach((group, groupIndex) => {
|
|
135
152
|
group.terminalInstances.forEach((terminal, terminalIndex) => {
|
|
136
153
|
const label = ( localize(
|
|
137
|
-
|
|
154
|
+
10534,
|
|
138
155
|
"{0}: {1}",
|
|
139
156
|
`${groupIndex + 1}.${terminalIndex + 1}`,
|
|
140
157
|
terminal.title
|
|
141
158
|
));
|
|
142
159
|
viewEntries.push({
|
|
143
160
|
label,
|
|
144
|
-
containerLabel: ( localize(
|
|
161
|
+
containerLabel: ( localize(10535, "Terminal")),
|
|
145
162
|
accept: async () => {
|
|
146
163
|
await this.terminalGroupService.showPanel(true);
|
|
147
164
|
this.terminalService.setActiveInstance(terminal);
|
|
@@ -153,9 +170,11 @@ let ViewQuickAccessProvider = class ViewQuickAccessProvider extends PickerQuickA
|
|
|
153
170
|
const label = session.name;
|
|
154
171
|
viewEntries.push({
|
|
155
172
|
label,
|
|
156
|
-
containerLabel: ( localize(
|
|
173
|
+
containerLabel: ( localize(10536, "Debug Console")),
|
|
157
174
|
accept: async () => {
|
|
158
|
-
await this.debugService.focusStackFrame(undefined, undefined, session, {
|
|
175
|
+
await this.debugService.focusStackFrame(undefined, undefined, session, {
|
|
176
|
+
explicit: true
|
|
177
|
+
});
|
|
159
178
|
if (!this.viewsService.isViewVisible(REPL_VIEW_ID)) {
|
|
160
179
|
await this.viewsService.openView(REPL_VIEW_ID, true);
|
|
161
180
|
}
|
|
@@ -166,7 +185,7 @@ let ViewQuickAccessProvider = class ViewQuickAccessProvider extends PickerQuickA
|
|
|
166
185
|
for (const channel of channels) {
|
|
167
186
|
viewEntries.push({
|
|
168
187
|
label: channel.label,
|
|
169
|
-
containerLabel: ( localize(
|
|
188
|
+
containerLabel: ( localize(10537, "Output")),
|
|
170
189
|
accept: () => this.outputService.showChannel(channel.id)
|
|
171
190
|
});
|
|
172
191
|
}
|
|
@@ -180,22 +199,15 @@ let ViewQuickAccessProvider = class ViewQuickAccessProvider extends PickerQuickA
|
|
|
180
199
|
return true;
|
|
181
200
|
}
|
|
182
201
|
};
|
|
183
|
-
ViewQuickAccessProvider = ViewQuickAccessProvider_1 = ( __decorate([
|
|
184
|
-
( __param(0, IViewDescriptorService)),
|
|
185
|
-
( __param(1, IViewsService)),
|
|
186
|
-
( __param(2, IOutputService)),
|
|
187
|
-
( __param(3, ITerminalService)),
|
|
188
|
-
( __param(4, ITerminalGroupService)),
|
|
189
|
-
( __param(5, IDebugService)),
|
|
190
|
-
( __param(6, IPaneCompositePartService)),
|
|
191
|
-
( __param(7, IContextKeyService))
|
|
192
|
-
], ViewQuickAccessProvider));
|
|
202
|
+
ViewQuickAccessProvider = ViewQuickAccessProvider_1 = ( __decorate([( __param(0, IViewDescriptorService)), ( __param(1, IViewsService)), ( __param(2, IOutputService)), ( __param(3, ITerminalService)), ( __param(4, ITerminalGroupService)), ( __param(5, IDebugService)), ( __param(6, IPaneCompositePartService)), ( __param(7, IContextKeyService))], ViewQuickAccessProvider));
|
|
193
203
|
class OpenViewPickerAction extends Action2 {
|
|
194
|
-
static {
|
|
204
|
+
static {
|
|
205
|
+
this.ID = "workbench.action.openView";
|
|
206
|
+
}
|
|
195
207
|
constructor() {
|
|
196
208
|
super({
|
|
197
209
|
id: OpenViewPickerAction.ID,
|
|
198
|
-
title: ( localize2(
|
|
210
|
+
title: ( localize2(10538, "Open View")),
|
|
199
211
|
category: Categories.View,
|
|
200
212
|
f1: true
|
|
201
213
|
});
|
|
@@ -205,16 +217,24 @@ class OpenViewPickerAction extends Action2 {
|
|
|
205
217
|
}
|
|
206
218
|
}
|
|
207
219
|
class QuickAccessViewPickerAction extends Action2 {
|
|
208
|
-
static {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
220
|
+
static {
|
|
221
|
+
this.ID = "workbench.action.quickOpenView";
|
|
222
|
+
}
|
|
223
|
+
static {
|
|
224
|
+
this.KEYBINDING = {
|
|
225
|
+
primary: KeyMod.CtrlCmd | KeyCode.KeyQ,
|
|
226
|
+
mac: {
|
|
227
|
+
primary: KeyMod.WinCtrl | KeyCode.KeyQ
|
|
228
|
+
},
|
|
229
|
+
linux: {
|
|
230
|
+
primary: 0
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
}
|
|
214
234
|
constructor() {
|
|
215
235
|
super({
|
|
216
236
|
id: QuickAccessViewPickerAction.ID,
|
|
217
|
-
title: ( localize2(
|
|
237
|
+
title: ( localize2(10539, "Quick Open View")),
|
|
218
238
|
category: Categories.View,
|
|
219
239
|
f1: false,
|
|
220
240
|
keybinding: {
|
|
@@ -228,7 +248,12 @@ class QuickAccessViewPickerAction extends Action2 {
|
|
|
228
248
|
const keybindingService = accessor.get(IKeybindingService);
|
|
229
249
|
const quickInputService = accessor.get(IQuickInputService);
|
|
230
250
|
const keys = keybindingService.lookupKeybindings(QuickAccessViewPickerAction.ID);
|
|
231
|
-
quickInputService.quickAccess.show(ViewQuickAccessProvider.PREFIX, {
|
|
251
|
+
quickInputService.quickAccess.show(ViewQuickAccessProvider.PREFIX, {
|
|
252
|
+
quickNavigateConfiguration: {
|
|
253
|
+
keybindings: keys
|
|
254
|
+
},
|
|
255
|
+
itemActivation: ItemActivation.FIRST
|
|
256
|
+
});
|
|
232
257
|
}
|
|
233
258
|
}
|
|
234
259
|
|
|
@@ -5,25 +5,23 @@ import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/
|
|
|
5
5
|
import { IBrowserWorkbenchEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/browser/environmentService.service';
|
|
6
6
|
|
|
7
7
|
let ExternalUriResolverContribution = class ExternalUriResolverContribution extends Disposable {
|
|
8
|
-
static {
|
|
8
|
+
static {
|
|
9
|
+
this.ID = "workbench.contrib.externalUriResolver";
|
|
10
|
+
}
|
|
9
11
|
constructor(_openerService, _workbenchEnvironmentService) {
|
|
10
12
|
super();
|
|
11
13
|
if (_workbenchEnvironmentService.options?.resolveExternalUri) {
|
|
12
14
|
this._register(_openerService.registerExternalUriResolver({
|
|
13
|
-
resolveExternalUri: async
|
|
15
|
+
resolveExternalUri: async resource => {
|
|
14
16
|
return {
|
|
15
17
|
resolved: await _workbenchEnvironmentService.options.resolveExternalUri(resource),
|
|
16
|
-
dispose: () => {
|
|
17
|
-
}
|
|
18
|
+
dispose: () => {}
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
21
|
}));
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
};
|
|
24
|
-
ExternalUriResolverContribution = ( __decorate([
|
|
25
|
-
( __param(0, IOpenerService)),
|
|
26
|
-
( __param(1, IBrowserWorkbenchEnvironmentService))
|
|
27
|
-
], ExternalUriResolverContribution));
|
|
25
|
+
ExternalUriResolverContribution = ( __decorate([( __param(0, IOpenerService)), ( __param(1, IBrowserWorkbenchEnvironmentService))], ExternalUriResolverContribution));
|
|
28
26
|
|
|
29
27
|
export { ExternalUriResolverContribution };
|
|
@@ -11,7 +11,7 @@ import { TRUSTED_DOMAINS_CONTENT_STORAGE_KEY, readTrustedDomains, TRUSTED_DOMAIN
|
|
|
11
11
|
import { assertReturnsDefined } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
12
12
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
13
13
|
|
|
14
|
-
const TRUSTED_DOMAINS_SCHEMA =
|
|
14
|
+
const TRUSTED_DOMAINS_SCHEMA = "trustedDomains";
|
|
15
15
|
const TRUSTED_DOMAINS_STAT = {
|
|
16
16
|
type: FileType.File,
|
|
17
17
|
ctime: Date.now(),
|
|
@@ -38,7 +38,7 @@ const CONFIG_HELP_TEXT_AFTER = `//
|
|
|
38
38
|
// Save this file to apply the trusted domains rules.
|
|
39
39
|
`;
|
|
40
40
|
const CONFIG_PLACEHOLDER_TEXT = `[
|
|
41
|
-
|
|
41
|
+
// "https://microsoft.com"
|
|
42
42
|
]`;
|
|
43
43
|
function computeTrustedDomainContent(defaultTrustedDomains, trustedDomains, configuring) {
|
|
44
44
|
let content = CONFIG_HELP_TEXT_PRE;
|
|
@@ -47,22 +47,22 @@ function computeTrustedDomainContent(defaultTrustedDomains, trustedDomains, conf
|
|
|
47
47
|
defaultTrustedDomains.forEach(d => {
|
|
48
48
|
content += `// - "${d}"\n`;
|
|
49
49
|
});
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
50
|
+
} else {
|
|
52
51
|
content += `// By default, VS Code trusts "localhost".\n`;
|
|
53
52
|
}
|
|
54
53
|
content += CONFIG_HELP_TEXT_AFTER;
|
|
55
|
-
content += configuring ? `\n// Currently configuring trust for ${configuring}\n` :
|
|
54
|
+
content += configuring ? `\n// Currently configuring trust for ${configuring}\n` : "";
|
|
56
55
|
if (trustedDomains.length === 0) {
|
|
57
56
|
content += CONFIG_PLACEHOLDER_TEXT;
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
57
|
+
} else {
|
|
60
58
|
content += JSON.stringify(trustedDomains, null, 2);
|
|
61
59
|
}
|
|
62
60
|
return content;
|
|
63
61
|
}
|
|
64
62
|
let TrustedDomainsFileSystemProvider = class TrustedDomainsFileSystemProvider {
|
|
65
|
-
static {
|
|
63
|
+
static {
|
|
64
|
+
this.ID = "workbench.contrib.trustedDomainsFileSystemProvider";
|
|
65
|
+
}
|
|
66
66
|
constructor(fileService, storageService, instantiationService) {
|
|
67
67
|
this.fileService = fileService;
|
|
68
68
|
this.storageService = storageService;
|
|
@@ -78,12 +78,11 @@ let TrustedDomainsFileSystemProvider = class TrustedDomainsFileSystemProvider {
|
|
|
78
78
|
async readFile(resource) {
|
|
79
79
|
let trustedDomainsContent = this.storageService.get(TRUSTED_DOMAINS_CONTENT_STORAGE_KEY, StorageScope.APPLICATION);
|
|
80
80
|
const configuring = resource.fragment;
|
|
81
|
-
const {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
( [...defaultTrustedDomains, ...trustedDomains].some(d => !assertReturnsDefined(trustedDomainsContent).includes(d)))) {
|
|
81
|
+
const {
|
|
82
|
+
defaultTrustedDomains,
|
|
83
|
+
trustedDomains
|
|
84
|
+
} = await this.instantiationService.invokeFunction(readTrustedDomains);
|
|
85
|
+
if (!trustedDomainsContent || trustedDomainsContent.indexOf(CONFIG_HELP_TEXT_PRE) === -1 || trustedDomainsContent.indexOf(CONFIG_HELP_TEXT_AFTER) === -1 || trustedDomainsContent.indexOf(configuring ?? "") === -1 || ( [...defaultTrustedDomains, ...trustedDomains].some(d => !assertReturnsDefined(trustedDomainsContent).includes(d)))) {
|
|
87
86
|
trustedDomainsContent = computeTrustedDomainContent(defaultTrustedDomains, trustedDomains, configuring);
|
|
88
87
|
}
|
|
89
88
|
const buffer = VSBuffer.fromString(trustedDomainsContent).buffer;
|
|
@@ -93,10 +92,19 @@ let TrustedDomainsFileSystemProvider = class TrustedDomainsFileSystemProvider {
|
|
|
93
92
|
try {
|
|
94
93
|
const trustedDomainsContent = ( VSBuffer.wrap(content).toString());
|
|
95
94
|
const trustedDomains = parse(trustedDomainsContent);
|
|
96
|
-
this.storageService.store(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
this.storageService.store(
|
|
96
|
+
TRUSTED_DOMAINS_CONTENT_STORAGE_KEY,
|
|
97
|
+
trustedDomainsContent,
|
|
98
|
+
StorageScope.APPLICATION,
|
|
99
|
+
StorageTarget.USER
|
|
100
|
+
);
|
|
101
|
+
this.storageService.store(
|
|
102
|
+
TRUSTED_DOMAINS_STORAGE_KEY,
|
|
103
|
+
JSON.stringify(trustedDomains) || "",
|
|
104
|
+
StorageScope.APPLICATION,
|
|
105
|
+
StorageTarget.USER
|
|
106
|
+
);
|
|
107
|
+
} catch (err) {}
|
|
100
108
|
return Promise.resolve();
|
|
101
109
|
}
|
|
102
110
|
watch(resource, opts) {
|
|
@@ -119,10 +127,6 @@ let TrustedDomainsFileSystemProvider = class TrustedDomainsFileSystemProvider {
|
|
|
119
127
|
return Promise.resolve(undefined);
|
|
120
128
|
}
|
|
121
129
|
};
|
|
122
|
-
TrustedDomainsFileSystemProvider = ( __decorate([
|
|
123
|
-
( __param(0, IFileService)),
|
|
124
|
-
( __param(1, IStorageService)),
|
|
125
|
-
( __param(2, IInstantiationService))
|
|
126
|
-
], TrustedDomainsFileSystemProvider));
|
|
130
|
+
TrustedDomainsFileSystemProvider = ( __decorate([( __param(0, IFileService)), ( __param(1, IStorageService)), ( __param(2, IInstantiationService))], TrustedDomainsFileSystemProvider));
|
|
127
131
|
|
|
128
132
|
export { TrustedDomainsFileSystemProvider };
|
|
@@ -20,7 +20,20 @@ import { readStaticTrustedDomains, configureOpenerTrustedDomainsHandler } from '
|
|
|
20
20
|
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
21
21
|
|
|
22
22
|
let OpenerValidatorContributions = class OpenerValidatorContributions {
|
|
23
|
-
constructor(
|
|
23
|
+
constructor(
|
|
24
|
+
_openerService,
|
|
25
|
+
_storageService,
|
|
26
|
+
_dialogService,
|
|
27
|
+
_productService,
|
|
28
|
+
_quickInputService,
|
|
29
|
+
_editorService,
|
|
30
|
+
_clipboardService,
|
|
31
|
+
_telemetryService,
|
|
32
|
+
_instantiationService,
|
|
33
|
+
_configurationService,
|
|
34
|
+
_workspaceTrustService,
|
|
35
|
+
_trustedDomainService
|
|
36
|
+
) {
|
|
24
37
|
this._openerService = _openerService;
|
|
25
38
|
this._storageService = _storageService;
|
|
26
39
|
this._dialogService = _dialogService;
|
|
@@ -33,74 +46,85 @@ let OpenerValidatorContributions = class OpenerValidatorContributions {
|
|
|
33
46
|
this._configurationService = _configurationService;
|
|
34
47
|
this._workspaceTrustService = _workspaceTrustService;
|
|
35
48
|
this._trustedDomainService = _trustedDomainService;
|
|
36
|
-
this._openerService.registerValidator({
|
|
49
|
+
this._openerService.registerValidator({
|
|
50
|
+
shouldOpen: (uri, options) => this.validateLink(uri, options)
|
|
51
|
+
});
|
|
37
52
|
}
|
|
38
53
|
async validateLink(resource, openOptions) {
|
|
39
54
|
if (!matchesScheme(resource, Schemas.http) && !matchesScheme(resource, Schemas.https)) {
|
|
40
55
|
return true;
|
|
41
56
|
}
|
|
42
|
-
if (openOptions?.fromWorkspace && this._workspaceTrustService.isWorkspaceTrusted() && !this._configurationService.getValue(
|
|
57
|
+
if (openOptions?.fromWorkspace && this._workspaceTrustService.isWorkspaceTrusted() && !this._configurationService.getValue("workbench.trustedDomains.promptInTrustedWorkspace")) {
|
|
43
58
|
return true;
|
|
44
59
|
}
|
|
45
60
|
const originalResource = resource;
|
|
46
61
|
let resourceUri;
|
|
47
|
-
if (typeof resource ===
|
|
62
|
+
if (typeof resource === "string") {
|
|
48
63
|
resourceUri = ( URI.parse(resource));
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
64
|
+
} else {
|
|
51
65
|
resourceUri = resource;
|
|
52
66
|
}
|
|
53
67
|
if (this._trustedDomainService.isValid(resourceUri)) {
|
|
54
68
|
return true;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
69
|
+
} else {
|
|
70
|
+
const {
|
|
71
|
+
scheme,
|
|
72
|
+
authority,
|
|
73
|
+
path,
|
|
74
|
+
query,
|
|
75
|
+
fragment
|
|
76
|
+
} = resourceUri;
|
|
58
77
|
let formattedLink = `${scheme}://${authority}${path}`;
|
|
59
|
-
const linkTail = `${query ?
|
|
78
|
+
const linkTail = `${query ? "?" + query : ""}${fragment ? "#" + fragment : ""}`;
|
|
60
79
|
const remainingLength = Math.max(0, 60 - formattedLink.length);
|
|
61
80
|
const linkTailLengthToKeep = Math.min(Math.max(5, remainingLength), linkTail.length);
|
|
62
81
|
if (linkTailLengthToKeep === linkTail.length) {
|
|
63
82
|
formattedLink += linkTail;
|
|
83
|
+
} else {
|
|
84
|
+
formattedLink += linkTail.charAt(0) + "..." + linkTail.substring(linkTail.length - linkTailLengthToKeep + 1);
|
|
64
85
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
const { result } = await this._dialogService.prompt({
|
|
86
|
+
const {
|
|
87
|
+
result
|
|
88
|
+
} = await this._dialogService.prompt({
|
|
69
89
|
type: Severity.Info,
|
|
70
90
|
message: ( localize(
|
|
71
|
-
|
|
72
|
-
|
|
91
|
+
13278,
|
|
92
|
+
"Do you want {0} to open the external website?",
|
|
73
93
|
this._productService.nameShort
|
|
74
94
|
)),
|
|
75
|
-
detail: typeof originalResource ===
|
|
76
|
-
buttons: [
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
{
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
95
|
+
detail: typeof originalResource === "string" ? originalResource : formattedLink,
|
|
96
|
+
buttons: [{
|
|
97
|
+
label: ( localize(13279, "&&Open")),
|
|
98
|
+
run: () => true
|
|
99
|
+
}, {
|
|
100
|
+
label: ( localize(13280, "&&Copy")),
|
|
101
|
+
run: () => {
|
|
102
|
+
this._clipboardService.writeText(typeof originalResource === "string" ? originalResource : ( resourceUri.toString(true)));
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
}, {
|
|
106
|
+
label: ( localize(13281, "Configure &&Trusted Domains")),
|
|
107
|
+
run: async () => {
|
|
108
|
+
const {
|
|
109
|
+
trustedDomains
|
|
110
|
+
} = this._instantiationService.invokeFunction(readStaticTrustedDomains);
|
|
111
|
+
const domainToOpen = `${scheme}://${authority}`;
|
|
112
|
+
const pickedDomains = await configureOpenerTrustedDomainsHandler(
|
|
113
|
+
trustedDomains,
|
|
114
|
+
domainToOpen,
|
|
115
|
+
resourceUri,
|
|
116
|
+
this._quickInputService,
|
|
117
|
+
this._storageService,
|
|
118
|
+
this._editorService);
|
|
119
|
+
if (pickedDomains.indexOf("*") !== -1) {
|
|
120
|
+
return true;
|
|
86
121
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
label: ( localize(12921, 'Configure &&Trusted Domains')),
|
|
90
|
-
run: async () => {
|
|
91
|
-
const { trustedDomains, } = this._instantiationService.invokeFunction(readStaticTrustedDomains);
|
|
92
|
-
const domainToOpen = `${scheme}://${authority}`;
|
|
93
|
-
const pickedDomains = await configureOpenerTrustedDomainsHandler(trustedDomains, domainToOpen, resourceUri, this._quickInputService, this._storageService, this._editorService);
|
|
94
|
-
if (pickedDomains.indexOf('*') !== -1) {
|
|
95
|
-
return true;
|
|
96
|
-
}
|
|
97
|
-
if (isURLDomainTrusted(resourceUri, pickedDomains)) {
|
|
98
|
-
return true;
|
|
99
|
-
}
|
|
100
|
-
return false;
|
|
122
|
+
if (isURLDomainTrusted(resourceUri, pickedDomains)) {
|
|
123
|
+
return true;
|
|
101
124
|
}
|
|
125
|
+
return false;
|
|
102
126
|
}
|
|
103
|
-
],
|
|
127
|
+
}],
|
|
104
128
|
cancelButton: {
|
|
105
129
|
run: () => false
|
|
106
130
|
}
|
|
@@ -109,19 +133,6 @@ let OpenerValidatorContributions = class OpenerValidatorContributions {
|
|
|
109
133
|
}
|
|
110
134
|
}
|
|
111
135
|
};
|
|
112
|
-
OpenerValidatorContributions = ( __decorate([
|
|
113
|
-
( __param(0, IOpenerService)),
|
|
114
|
-
( __param(1, IStorageService)),
|
|
115
|
-
( __param(2, IDialogService)),
|
|
116
|
-
( __param(3, IProductService)),
|
|
117
|
-
( __param(4, IQuickInputService)),
|
|
118
|
-
( __param(5, IEditorService)),
|
|
119
|
-
( __param(6, IClipboardService)),
|
|
120
|
-
( __param(7, ITelemetryService)),
|
|
121
|
-
( __param(8, IInstantiationService)),
|
|
122
|
-
( __param(9, IConfigurationService)),
|
|
123
|
-
( __param(10, IWorkspaceTrustManagementService)),
|
|
124
|
-
( __param(11, ITrustedDomainService))
|
|
125
|
-
], OpenerValidatorContributions));
|
|
136
|
+
OpenerValidatorContributions = ( __decorate([( __param(0, IOpenerService)), ( __param(1, IStorageService)), ( __param(2, IDialogService)), ( __param(3, IProductService)), ( __param(4, IQuickInputService)), ( __param(5, IEditorService)), ( __param(6, IClipboardService)), ( __param(7, ITelemetryService)), ( __param(8, IInstantiationService)), ( __param(9, IConfigurationService)), ( __param(10, IWorkspaceTrustManagementService)), ( __param(11, ITrustedDomainService))], OpenerValidatorContributions));
|
|
126
137
|
|
|
127
138
|
export { OpenerValidatorContributions };
|