@codingame/monaco-vscode-quickaccess-service-override 4.5.1 → 5.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/editor/contrib/quickAccess/browser/commandsQuickAccess.js +11 -0
- package/vscode/src/vs/platform/quickinput/browser/commandsQuickAccess.js +29 -59
- package/vscode/src/vs/platform/quickinput/browser/helpQuickAccess.js +19 -22
- package/vscode/src/vs/workbench/browser/actions/quickAccessActions.js +7 -30
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoLineQuickAccess.js +11 -18
- package/vscode/src/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.js +48 -79
- package/vscode/src/vs/workbench/contrib/quickaccess/browser/quickAccess.contribution.js +22 -62
- package/vscode/src/vs/workbench/contrib/quickaccess/browser/viewQuickAccess.js +25 -60
- package/vscode/src/vs/workbench/contrib/url/browser/trustedDomains.js +16 -42
- package/vscode/src/vs/workbench/contrib/url/browser/trustedDomainsValidator.js +43 -48
- package/vscode/src/vs/workbench/contrib/url/browser/url.contribution.js +8 -11
|
@@ -10,28 +10,21 @@ import { inQuickPickContext, getQuickNavigateHandler } from 'vscode/vscode/vs/wo
|
|
|
10
10
|
import { KeybindingsRegistry } from 'vscode/vscode/vs/platform/keybinding/common/keybindingsRegistry';
|
|
11
11
|
import { EditorContextKeys } from 'vscode/vscode/vs/editor/common/editorContextKeys';
|
|
12
12
|
|
|
13
|
-
const
|
|
13
|
+
const _moduleId = "vs/workbench/contrib/quickaccess/browser/quickAccess.contribution";
|
|
14
|
+
const quickAccessRegistry = ( (Registry.as(Extensions.Quickaccess)));
|
|
14
15
|
quickAccessRegistry.registerQuickAccessProvider({
|
|
15
16
|
ctor: HelpQuickAccessProvider,
|
|
16
17
|
prefix: HelpQuickAccessProvider.PREFIX,
|
|
17
18
|
placeholder: ( localizeWithPath(
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
_moduleId,
|
|
20
|
+
0,
|
|
20
21
|
"Type '{0}' to get help on the actions you can take from here.",
|
|
21
22
|
HelpQuickAccessProvider.PREFIX
|
|
22
23
|
)),
|
|
23
24
|
helpEntries: [{
|
|
24
|
-
description: ( localizeWithPath(
|
|
25
|
-
'vs/workbench/contrib/quickaccess/browser/quickAccess.contribution',
|
|
26
|
-
'helpQuickAccess',
|
|
27
|
-
"Show all Quick Access Providers"
|
|
28
|
-
)),
|
|
25
|
+
description: ( localizeWithPath(_moduleId, 1, "Show all Quick Access Providers")),
|
|
29
26
|
commandCenterOrder: 70,
|
|
30
|
-
commandCenterLabel: ( localizeWithPath(
|
|
31
|
-
'vs/workbench/contrib/quickaccess/browser/quickAccess.contribution',
|
|
32
|
-
'more',
|
|
33
|
-
'More'
|
|
34
|
-
))
|
|
27
|
+
commandCenterLabel: ( localizeWithPath(_moduleId, 2, 'More'))
|
|
35
28
|
}]
|
|
36
29
|
});
|
|
37
30
|
quickAccessRegistry.registerQuickAccessProvider({
|
|
@@ -39,40 +32,24 @@ quickAccessRegistry.registerQuickAccessProvider({
|
|
|
39
32
|
prefix: ViewQuickAccessProvider.PREFIX,
|
|
40
33
|
contextKey: 'inViewsPicker',
|
|
41
34
|
placeholder: ( localizeWithPath(
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
_moduleId,
|
|
36
|
+
3,
|
|
44
37
|
"Type the name of a view, output channel or terminal to open."
|
|
45
38
|
)),
|
|
46
|
-
helpEntries: [{ description: ( localizeWithPath(
|
|
47
|
-
'vs/workbench/contrib/quickaccess/browser/quickAccess.contribution',
|
|
48
|
-
'viewQuickAccess',
|
|
49
|
-
"Open View"
|
|
50
|
-
)), commandId: OpenViewPickerAction.ID }]
|
|
39
|
+
helpEntries: [{ description: ( localizeWithPath(_moduleId, 4, "Open View")), commandId: OpenViewPickerAction.ID }]
|
|
51
40
|
});
|
|
52
41
|
quickAccessRegistry.registerQuickAccessProvider({
|
|
53
42
|
ctor: CommandsQuickAccessProvider,
|
|
54
43
|
prefix: CommandsQuickAccessProvider.PREFIX,
|
|
55
44
|
contextKey: 'inCommandsPicker',
|
|
56
|
-
placeholder: ( localizeWithPath(
|
|
57
|
-
|
|
58
|
-
'commandsQuickAccessPlaceholder',
|
|
59
|
-
"Type the name of a command to run."
|
|
60
|
-
)),
|
|
61
|
-
helpEntries: [{ description: ( localizeWithPath(
|
|
62
|
-
'vs/workbench/contrib/quickaccess/browser/quickAccess.contribution',
|
|
63
|
-
'commandsQuickAccess',
|
|
64
|
-
"Show and Run Commands"
|
|
65
|
-
)), commandId: ShowAllCommandsAction.ID, commandCenterOrder: 20 }]
|
|
45
|
+
placeholder: ( localizeWithPath(_moduleId, 5, "Type the name of a command to run.")),
|
|
46
|
+
helpEntries: [{ description: ( localizeWithPath(_moduleId, 6, "Show and Run Commands")), commandId: ShowAllCommandsAction.ID, commandCenterOrder: 20 }]
|
|
66
47
|
});
|
|
67
48
|
MenuRegistry.appendMenuItem(MenuId.MenubarViewMenu, {
|
|
68
49
|
group: '1_open',
|
|
69
50
|
command: {
|
|
70
51
|
id: ShowAllCommandsAction.ID,
|
|
71
|
-
title: ( localizeWithPath(
|
|
72
|
-
'vs/workbench/contrib/quickaccess/browser/quickAccess.contribution',
|
|
73
|
-
{ key: 'miCommandPalette', comment: ['&& denotes a mnemonic'] },
|
|
74
|
-
"&&Command Palette..."
|
|
75
|
-
))
|
|
52
|
+
title: ( localizeWithPath(_moduleId, 7, "&&Command Palette..."))
|
|
76
53
|
},
|
|
77
54
|
order: 1
|
|
78
55
|
});
|
|
@@ -80,11 +57,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
|
|
|
80
57
|
group: '1_welcome',
|
|
81
58
|
command: {
|
|
82
59
|
id: ShowAllCommandsAction.ID,
|
|
83
|
-
title: ( localizeWithPath(
|
|
84
|
-
'vs/workbench/contrib/quickaccess/browser/quickAccess.contribution',
|
|
85
|
-
{ key: 'miShowAllCommands', comment: ['&& denotes a mnemonic'] },
|
|
86
|
-
"Show All Commands"
|
|
87
|
-
))
|
|
60
|
+
title: ( localizeWithPath(_moduleId, 8, "Show All Commands"))
|
|
88
61
|
},
|
|
89
62
|
order: 2
|
|
90
63
|
});
|
|
@@ -92,11 +65,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarViewMenu, {
|
|
|
92
65
|
group: '1_open',
|
|
93
66
|
command: {
|
|
94
67
|
id: OpenViewPickerAction.ID,
|
|
95
|
-
title: ( localizeWithPath(
|
|
96
|
-
'vs/workbench/contrib/quickaccess/browser/quickAccess.contribution',
|
|
97
|
-
{ key: 'miOpenView', comment: ['&& denotes a mnemonic'] },
|
|
98
|
-
"&&Open View..."
|
|
99
|
-
))
|
|
68
|
+
title: ( localizeWithPath(_moduleId, 9, "&&Open View..."))
|
|
100
69
|
},
|
|
101
70
|
order: 2
|
|
102
71
|
});
|
|
@@ -104,11 +73,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarGoMenu, {
|
|
|
104
73
|
group: '5_infile_nav',
|
|
105
74
|
command: {
|
|
106
75
|
id: 'workbench.action.gotoLine',
|
|
107
|
-
title: ( localizeWithPath(
|
|
108
|
-
'vs/workbench/contrib/quickaccess/browser/quickAccess.contribution',
|
|
109
|
-
{ key: 'miGotoLine', comment: ['&& denotes a mnemonic'] },
|
|
110
|
-
"Go to &&Line/Column..."
|
|
111
|
-
))
|
|
76
|
+
title: ( localizeWithPath(_moduleId, 10, "Go to &&Line/Column..."))
|
|
112
77
|
},
|
|
113
78
|
order: 1
|
|
114
79
|
});
|
|
@@ -116,24 +81,16 @@ MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
|
|
|
116
81
|
group: '1_command',
|
|
117
82
|
command: {
|
|
118
83
|
id: ShowAllCommandsAction.ID,
|
|
119
|
-
title: ( localizeWithPath(
|
|
120
|
-
'vs/workbench/contrib/quickaccess/browser/quickAccess.contribution',
|
|
121
|
-
'commandPalette',
|
|
122
|
-
"Command Palette..."
|
|
123
|
-
))
|
|
84
|
+
title: ( localizeWithPath(_moduleId, 11, "Command Palette..."))
|
|
124
85
|
},
|
|
125
86
|
order: 1
|
|
126
87
|
});
|
|
127
88
|
MenuRegistry.appendMenuItem(MenuId.EditorContext, {
|
|
128
89
|
group: 'z_commands',
|
|
129
|
-
when: ( EditorContextKeys.editorSimpleInput.toNegated()),
|
|
90
|
+
when: ( (EditorContextKeys.editorSimpleInput.toNegated())),
|
|
130
91
|
command: {
|
|
131
92
|
id: ShowAllCommandsAction.ID,
|
|
132
|
-
title: ( localizeWithPath(
|
|
133
|
-
'vs/workbench/contrib/quickaccess/browser/quickAccess.contribution',
|
|
134
|
-
'commandPalette',
|
|
135
|
-
"Command Palette..."
|
|
136
|
-
)),
|
|
93
|
+
title: ( localizeWithPath(_moduleId, 11, "Command Palette...")),
|
|
137
94
|
},
|
|
138
95
|
order: 1
|
|
139
96
|
});
|
|
@@ -142,7 +99,10 @@ registerAction2(ShowAllCommandsAction);
|
|
|
142
99
|
registerAction2(OpenViewPickerAction);
|
|
143
100
|
registerAction2(QuickAccessViewPickerAction);
|
|
144
101
|
const inViewsPickerContextKey = 'inViewsPicker';
|
|
145
|
-
const inViewsPickerContext = ( ContextKeyExpr.and(
|
|
102
|
+
const inViewsPickerContext = ( (ContextKeyExpr.and(
|
|
103
|
+
inQuickPickContext,
|
|
104
|
+
(ContextKeyExpr.has(inViewsPickerContextKey))
|
|
105
|
+
)));
|
|
146
106
|
const viewPickerKeybinding = QuickAccessViewPickerAction.KEYBINDING;
|
|
147
107
|
const quickAccessNavigateNextInViewPickerId = 'workbench.action.quickOpenNavigateNextInViewPicker';
|
|
148
108
|
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
@@ -18,17 +18,14 @@ import { REPL_VIEW_ID } from 'vscode/vscode/vs/workbench/contrib/debug/common/de
|
|
|
18
18
|
import { IDebugService } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug.service';
|
|
19
19
|
|
|
20
20
|
var ViewQuickAccessProvider_1;
|
|
21
|
+
const _moduleId = "vs/workbench/contrib/quickaccess/browser/viewQuickAccess";
|
|
21
22
|
let ViewQuickAccessProvider = class ViewQuickAccessProvider extends PickerQuickAccessProvider {
|
|
22
23
|
static { ViewQuickAccessProvider_1 = this; }
|
|
23
24
|
static { this.PREFIX = 'view '; }
|
|
24
25
|
constructor(viewDescriptorService, viewsService, outputService, terminalService, terminalGroupService, debugService, paneCompositeService, contextKeyService) {
|
|
25
26
|
super(ViewQuickAccessProvider_1.PREFIX, {
|
|
26
27
|
noResultsPick: {
|
|
27
|
-
label: ( localizeWithPath(
|
|
28
|
-
'vs/workbench/contrib/quickaccess/browser/viewQuickAccess',
|
|
29
|
-
'noViewResults',
|
|
30
|
-
"No matching views"
|
|
31
|
-
)),
|
|
28
|
+
label: ( localizeWithPath(_moduleId, 0, "No matching views")),
|
|
32
29
|
containerLabel: ''
|
|
33
30
|
}
|
|
34
31
|
});
|
|
@@ -49,9 +46,9 @@ let ViewQuickAccessProvider = class ViewQuickAccessProvider extends PickerQuickA
|
|
|
49
46
|
entry.highlights = { label: matchesFuzzy(filter, entry.label, true) ?? undefined };
|
|
50
47
|
return entry.highlights.label || fuzzyContains(entry.containerLabel, filter);
|
|
51
48
|
});
|
|
52
|
-
const mapEntryToContainer = ( new Map());
|
|
49
|
+
const mapEntryToContainer = ( (new Map()));
|
|
53
50
|
for (const entry of filteredViewEntries) {
|
|
54
|
-
if (!( mapEntryToContainer.has(entry.label))) {
|
|
51
|
+
if (!( (mapEntryToContainer.has(entry.label)))) {
|
|
55
52
|
mapEntryToContainer.set(entry.label, entry.containerLabel);
|
|
56
53
|
}
|
|
57
54
|
}
|
|
@@ -61,7 +58,7 @@ let ViewQuickAccessProvider = class ViewQuickAccessProvider extends PickerQuickA
|
|
|
61
58
|
if (lastContainer !== entry.containerLabel) {
|
|
62
59
|
lastContainer = entry.containerLabel;
|
|
63
60
|
let separatorLabel;
|
|
64
|
-
if (( mapEntryToContainer.has(lastContainer))) {
|
|
61
|
+
if (( (mapEntryToContainer.has(lastContainer)))) {
|
|
65
62
|
separatorLabel = `${mapEntryToContainer.get(lastContainer)} / ${lastContainer}`;
|
|
66
63
|
}
|
|
67
64
|
else {
|
|
@@ -116,21 +113,9 @@ let ViewQuickAccessProvider = class ViewQuickAccessProvider extends PickerQuickA
|
|
|
116
113
|
}
|
|
117
114
|
}
|
|
118
115
|
};
|
|
119
|
-
addPaneComposites(0 , ( localizeWithPath(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
"Side Bar"
|
|
123
|
-
)));
|
|
124
|
-
addPaneComposites(1 , ( localizeWithPath(
|
|
125
|
-
'vs/workbench/contrib/quickaccess/browser/viewQuickAccess',
|
|
126
|
-
'panels',
|
|
127
|
-
"Panel"
|
|
128
|
-
)));
|
|
129
|
-
addPaneComposites(2 , ( localizeWithPath(
|
|
130
|
-
'vs/workbench/contrib/quickaccess/browser/viewQuickAccess',
|
|
131
|
-
'secondary side bar',
|
|
132
|
-
"Secondary Side Bar"
|
|
133
|
-
)));
|
|
116
|
+
addPaneComposites(0 , ( localizeWithPath(_moduleId, 1, "Side Bar")));
|
|
117
|
+
addPaneComposites(1 , ( localizeWithPath(_moduleId, 2, "Panel")));
|
|
118
|
+
addPaneComposites(2 , ( localizeWithPath(_moduleId, 3, "Secondary Side Bar")));
|
|
134
119
|
const addPaneCompositeViews = (location) => {
|
|
135
120
|
const paneComposites = this.paneCompositeService.getPaneComposites(location);
|
|
136
121
|
for (const paneComposite of paneComposites) {
|
|
@@ -146,19 +131,15 @@ let ViewQuickAccessProvider = class ViewQuickAccessProvider extends PickerQuickA
|
|
|
146
131
|
this.terminalGroupService.groups.forEach((group, groupIndex) => {
|
|
147
132
|
group.terminalInstances.forEach((terminal, terminalIndex) => {
|
|
148
133
|
const label = ( localizeWithPath(
|
|
149
|
-
|
|
150
|
-
|
|
134
|
+
_moduleId,
|
|
135
|
+
4,
|
|
151
136
|
"{0}: {1}",
|
|
152
137
|
`${groupIndex + 1}.${terminalIndex + 1}`,
|
|
153
138
|
terminal.title
|
|
154
139
|
));
|
|
155
140
|
viewEntries.push({
|
|
156
141
|
label,
|
|
157
|
-
containerLabel: ( localizeWithPath(
|
|
158
|
-
'vs/workbench/contrib/quickaccess/browser/viewQuickAccess',
|
|
159
|
-
'terminals',
|
|
160
|
-
"Terminal"
|
|
161
|
-
)),
|
|
142
|
+
containerLabel: ( localizeWithPath(_moduleId, 5, "Terminal")),
|
|
162
143
|
accept: async () => {
|
|
163
144
|
await this.terminalGroupService.showPanel(true);
|
|
164
145
|
this.terminalService.setActiveInstance(terminal);
|
|
@@ -170,11 +151,7 @@ let ViewQuickAccessProvider = class ViewQuickAccessProvider extends PickerQuickA
|
|
|
170
151
|
const label = session.name;
|
|
171
152
|
viewEntries.push({
|
|
172
153
|
label,
|
|
173
|
-
containerLabel: ( localizeWithPath(
|
|
174
|
-
'vs/workbench/contrib/quickaccess/browser/viewQuickAccess',
|
|
175
|
-
'debugConsoles',
|
|
176
|
-
"Debug Console"
|
|
177
|
-
)),
|
|
154
|
+
containerLabel: ( localizeWithPath(_moduleId, 6, "Debug Console")),
|
|
178
155
|
accept: async () => {
|
|
179
156
|
await this.debugService.focusStackFrame(undefined, undefined, session, { explicit: true });
|
|
180
157
|
if (!this.viewsService.isViewVisible(REPL_VIEW_ID)) {
|
|
@@ -187,11 +164,7 @@ let ViewQuickAccessProvider = class ViewQuickAccessProvider extends PickerQuickA
|
|
|
187
164
|
for (const channel of channels) {
|
|
188
165
|
viewEntries.push({
|
|
189
166
|
label: channel.label,
|
|
190
|
-
containerLabel: ( localizeWithPath(
|
|
191
|
-
'vs/workbench/contrib/quickaccess/browser/viewQuickAccess',
|
|
192
|
-
'channels',
|
|
193
|
-
"Output"
|
|
194
|
-
)),
|
|
167
|
+
containerLabel: ( localizeWithPath(_moduleId, 7, "Output")),
|
|
195
168
|
accept: () => this.outputService.showChannel(channel.id)
|
|
196
169
|
});
|
|
197
170
|
}
|
|
@@ -205,26 +178,22 @@ let ViewQuickAccessProvider = class ViewQuickAccessProvider extends PickerQuickA
|
|
|
205
178
|
return true;
|
|
206
179
|
}
|
|
207
180
|
};
|
|
208
|
-
ViewQuickAccessProvider = ViewQuickAccessProvider_1 = ( __decorate([
|
|
209
|
-
( __param(0, IViewDescriptorService)),
|
|
210
|
-
( __param(1, IViewsService)),
|
|
211
|
-
( __param(2, IOutputService)),
|
|
212
|
-
( __param(3, ITerminalService)),
|
|
213
|
-
( __param(4, ITerminalGroupService)),
|
|
214
|
-
( __param(5, IDebugService)),
|
|
215
|
-
( __param(6, IPaneCompositePartService)),
|
|
216
|
-
( __param(7, IContextKeyService))
|
|
217
|
-
], ViewQuickAccessProvider));
|
|
181
|
+
ViewQuickAccessProvider = ViewQuickAccessProvider_1 = ( (__decorate([
|
|
182
|
+
( (__param(0, IViewDescriptorService))),
|
|
183
|
+
( (__param(1, IViewsService))),
|
|
184
|
+
( (__param(2, IOutputService))),
|
|
185
|
+
( (__param(3, ITerminalService))),
|
|
186
|
+
( (__param(4, ITerminalGroupService))),
|
|
187
|
+
( (__param(5, IDebugService))),
|
|
188
|
+
( (__param(6, IPaneCompositePartService))),
|
|
189
|
+
( (__param(7, IContextKeyService)))
|
|
190
|
+
], ViewQuickAccessProvider)));
|
|
218
191
|
class OpenViewPickerAction extends Action2 {
|
|
219
192
|
static { this.ID = 'workbench.action.openView'; }
|
|
220
193
|
constructor() {
|
|
221
194
|
super({
|
|
222
195
|
id: OpenViewPickerAction.ID,
|
|
223
|
-
title: ( localize2WithPath(
|
|
224
|
-
'vs/workbench/contrib/quickaccess/browser/viewQuickAccess',
|
|
225
|
-
'openView',
|
|
226
|
-
'Open View'
|
|
227
|
-
)),
|
|
196
|
+
title: ( localize2WithPath(_moduleId, 8, 'Open View')),
|
|
228
197
|
category: Categories.View,
|
|
229
198
|
f1: true
|
|
230
199
|
});
|
|
@@ -243,11 +212,7 @@ class QuickAccessViewPickerAction extends Action2 {
|
|
|
243
212
|
constructor() {
|
|
244
213
|
super({
|
|
245
214
|
id: QuickAccessViewPickerAction.ID,
|
|
246
|
-
title: ( localize2WithPath(
|
|
247
|
-
'vs/workbench/contrib/quickaccess/browser/viewQuickAccess',
|
|
248
|
-
'quickOpenView',
|
|
249
|
-
'Quick Open View'
|
|
250
|
-
)),
|
|
215
|
+
title: ( localize2WithPath(_moduleId, 9, 'Quick Open View')),
|
|
251
216
|
category: Categories.View,
|
|
252
217
|
f1: false,
|
|
253
218
|
keybinding: {
|
|
@@ -9,17 +9,14 @@ import { ITextFileService } from 'vscode/vscode/vs/workbench/services/textfile/c
|
|
|
9
9
|
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
|
|
10
10
|
import { IBrowserWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/browser/environmentService.service';
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const _moduleId = "vs/workbench/contrib/url/browser/trustedDomains";
|
|
13
|
+
const TRUSTED_DOMAINS_URI = ( (URI.parse('trustedDomains:/Trusted Domains')));
|
|
13
14
|
const TRUSTED_DOMAINS_STORAGE_KEY = 'http.linkProtectionTrustedDomains';
|
|
14
15
|
const TRUSTED_DOMAINS_CONTENT_STORAGE_KEY = 'http.linkProtectionTrustedDomainsContent';
|
|
15
16
|
const manageTrustedDomainSettingsCommand = {
|
|
16
17
|
id: 'workbench.action.manageTrustedDomain',
|
|
17
18
|
description: {
|
|
18
|
-
description: ( localize2WithPath(
|
|
19
|
-
'vs/workbench/contrib/url/browser/trustedDomains',
|
|
20
|
-
'trustedDomain.manageTrustedDomain',
|
|
21
|
-
'Manage Trusted Domains'
|
|
22
|
-
)),
|
|
19
|
+
description: ( localize2WithPath(_moduleId, 0, 'Manage Trusted Domains')),
|
|
23
20
|
args: []
|
|
24
21
|
},
|
|
25
22
|
handler: async (accessor) => {
|
|
@@ -29,19 +26,14 @@ const manageTrustedDomainSettingsCommand = {
|
|
|
29
26
|
}
|
|
30
27
|
};
|
|
31
28
|
async function configureOpenerTrustedDomainsHandler(trustedDomains, domainToConfigure, resource, quickInputService, storageService, editorService, telemetryService) {
|
|
32
|
-
const parsedDomainToConfigure = ( URI.parse(domainToConfigure));
|
|
29
|
+
const parsedDomainToConfigure = ( (URI.parse(domainToConfigure)));
|
|
33
30
|
const toplevelDomainSegements = parsedDomainToConfigure.authority.split('.');
|
|
34
31
|
const domainEnd = toplevelDomainSegements.slice(toplevelDomainSegements.length - 2).join('.');
|
|
35
32
|
const topLevelDomain = '*.' + domainEnd;
|
|
36
33
|
const options = [];
|
|
37
34
|
options.push({
|
|
38
35
|
type: 'item',
|
|
39
|
-
label: ( localizeWithPath(
|
|
40
|
-
'vs/workbench/contrib/url/browser/trustedDomains',
|
|
41
|
-
'trustedDomain.trustDomain',
|
|
42
|
-
'Trust {0}',
|
|
43
|
-
domainToConfigure
|
|
44
|
-
)),
|
|
36
|
+
label: ( localizeWithPath(_moduleId, 1, 'Trust {0}', domainToConfigure)),
|
|
45
37
|
id: 'trust',
|
|
46
38
|
toTrust: domainToConfigure,
|
|
47
39
|
picked: true
|
|
@@ -53,12 +45,7 @@ async function configureOpenerTrustedDomainsHandler(trustedDomains, domainToConf
|
|
|
53
45
|
const base = parsedDomainToConfigure.authority.split(':')[0];
|
|
54
46
|
options.push({
|
|
55
47
|
type: 'item',
|
|
56
|
-
label: ( localizeWithPath(
|
|
57
|
-
'vs/workbench/contrib/url/browser/trustedDomains',
|
|
58
|
-
'trustedDomain.trustAllPorts',
|
|
59
|
-
'Trust {0} on all ports',
|
|
60
|
-
base
|
|
61
|
-
)),
|
|
48
|
+
label: ( localizeWithPath(_moduleId, 2, 'Trust {0} on all ports', base)),
|
|
62
49
|
toTrust: base + ':*',
|
|
63
50
|
id: 'trust'
|
|
64
51
|
});
|
|
@@ -67,33 +54,20 @@ async function configureOpenerTrustedDomainsHandler(trustedDomains, domainToConf
|
|
|
67
54
|
else {
|
|
68
55
|
options.push({
|
|
69
56
|
type: 'item',
|
|
70
|
-
label: ( localizeWithPath(
|
|
71
|
-
'vs/workbench/contrib/url/browser/trustedDomains',
|
|
72
|
-
'trustedDomain.trustSubDomain',
|
|
73
|
-
'Trust {0} and all its subdomains',
|
|
74
|
-
domainEnd
|
|
75
|
-
)),
|
|
57
|
+
label: ( localizeWithPath(_moduleId, 3, 'Trust {0} and all its subdomains', domainEnd)),
|
|
76
58
|
toTrust: topLevelDomain,
|
|
77
59
|
id: 'trust'
|
|
78
60
|
});
|
|
79
61
|
}
|
|
80
62
|
options.push({
|
|
81
63
|
type: 'item',
|
|
82
|
-
label: ( localizeWithPath(
|
|
83
|
-
'vs/workbench/contrib/url/browser/trustedDomains',
|
|
84
|
-
'trustedDomain.trustAllDomains',
|
|
85
|
-
'Trust all domains (disables link protection)'
|
|
86
|
-
)),
|
|
64
|
+
label: ( localizeWithPath(_moduleId, 4, 'Trust all domains (disables link protection)')),
|
|
87
65
|
toTrust: '*',
|
|
88
66
|
id: 'trust'
|
|
89
67
|
});
|
|
90
68
|
options.push({
|
|
91
69
|
type: 'item',
|
|
92
|
-
label: ( localizeWithPath(
|
|
93
|
-
'vs/workbench/contrib/url/browser/trustedDomains',
|
|
94
|
-
'trustedDomain.manageTrustedDomains',
|
|
95
|
-
'Manage Trusted Domains'
|
|
96
|
-
)),
|
|
70
|
+
label: ( localizeWithPath(_moduleId, 5, 'Manage Trusted Domains')),
|
|
97
71
|
id: 'manage'
|
|
98
72
|
});
|
|
99
73
|
const pickedResult = await quickInputService.pick(options, { activeItem: options[0] });
|
|
@@ -101,7 +75,7 @@ async function configureOpenerTrustedDomainsHandler(trustedDomains, domainToConf
|
|
|
101
75
|
switch (pickedResult.id) {
|
|
102
76
|
case 'manage':
|
|
103
77
|
await editorService.openEditor({
|
|
104
|
-
resource: TRUSTED_DOMAINS_URI.with({ fragment: ( resource.toString()) }),
|
|
78
|
+
resource: TRUSTED_DOMAINS_URI.with({ fragment: ( (resource.toString())) }),
|
|
105
79
|
languageId: 'jsonc',
|
|
106
80
|
options: { pinned: true }
|
|
107
81
|
});
|
|
@@ -119,7 +93,7 @@ async function configureOpenerTrustedDomainsHandler(trustedDomains, domainToConf
|
|
|
119
93
|
return [];
|
|
120
94
|
}
|
|
121
95
|
function extractGitHubRemotesFromGitConfig(gitConfig) {
|
|
122
|
-
const domains = ( new Set());
|
|
96
|
+
const domains = ( (new Set()));
|
|
123
97
|
let match;
|
|
124
98
|
const RemoteMatcher = /^\s*url\s*=\s*(?:git@|https:\/\/)github\.com(?::|\/)(\S*)\s*$/mg;
|
|
125
99
|
while (match = RemoteMatcher.exec(gitConfig)) {
|
|
@@ -131,10 +105,10 @@ function extractGitHubRemotesFromGitConfig(gitConfig) {
|
|
|
131
105
|
return [...domains];
|
|
132
106
|
}
|
|
133
107
|
async function getRemotes(fileService, textFileService, contextService) {
|
|
134
|
-
const workspaceUris = ( contextService.getWorkspace().folders.map(folder => folder.uri));
|
|
108
|
+
const workspaceUris = ( (contextService.getWorkspace().folders.map(folder => folder.uri)));
|
|
135
109
|
const domains = await Promise.race([
|
|
136
|
-
( new Promise(resolve => setTimeout(() => resolve([]), 2000))),
|
|
137
|
-
Promise.all(( workspaceUris.map(async (workspaceUri) => {
|
|
110
|
+
( (new Promise(resolve => setTimeout(() => resolve([]), 2000)))),
|
|
111
|
+
Promise.all(( (workspaceUris.map(async (workspaceUri) => {
|
|
138
112
|
try {
|
|
139
113
|
const path = workspaceUri.path;
|
|
140
114
|
const uri = workspaceUri.with({ path: `${path !== '/' ? path : ''}/.git/config` });
|
|
@@ -148,9 +122,9 @@ async function getRemotes(fileService, textFileService, contextService) {
|
|
|
148
122
|
catch {
|
|
149
123
|
return [];
|
|
150
124
|
}
|
|
151
|
-
})))
|
|
125
|
+
}))))
|
|
152
126
|
]);
|
|
153
|
-
const set = domains.reduce((set, list) => list.reduce((set, item) => set.add(item), set), ( new Set()));
|
|
127
|
+
const set = domains.reduce((set, list) => list.reduce((set, item) => set.add(item), set), ( (new Set())));
|
|
154
128
|
return [...set];
|
|
155
129
|
}
|
|
156
130
|
async function readTrustedDomains(accessor) {
|
|
@@ -21,6 +21,7 @@ import { testUrlMatchesGlob } from 'vscode/vscode/vs/workbench/contrib/url/commo
|
|
|
21
21
|
import { IAuthenticationService } from 'vscode/vscode/vs/workbench/services/authentication/common/authentication.service';
|
|
22
22
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
23
23
|
|
|
24
|
+
const _moduleId = "vs/workbench/contrib/url/browser/trustedDomainsValidator";
|
|
24
25
|
let OpenerValidatorContributions = class OpenerValidatorContributions {
|
|
25
26
|
constructor(_openerService, _storageService, _dialogService, _productService, _quickInputService, _editorService, _clipboardService, _telemetryService, _instantiationService, _authenticationService, _workspaceContextService, _configurationService, _workspaceTrustService) {
|
|
26
27
|
this._openerService = _openerService;
|
|
@@ -37,27 +38,27 @@ let OpenerValidatorContributions = class OpenerValidatorContributions {
|
|
|
37
38
|
this._configurationService = _configurationService;
|
|
38
39
|
this._workspaceTrustService = _workspaceTrustService;
|
|
39
40
|
this._openerService.registerValidator({ shouldOpen: (uri, options) => this.validateLink(uri, options) });
|
|
40
|
-
this._readAuthenticationTrustedDomainsResult = ( new WindowIdleValue(
|
|
41
|
+
this._readAuthenticationTrustedDomainsResult = ( (new WindowIdleValue(
|
|
41
42
|
mainWindow,
|
|
42
43
|
() => this._instantiationService.invokeFunction(readAuthenticationTrustedDomains)
|
|
43
|
-
));
|
|
44
|
+
)));
|
|
44
45
|
this._authenticationService.onDidRegisterAuthenticationProvider(() => {
|
|
45
46
|
this._readAuthenticationTrustedDomainsResult?.dispose();
|
|
46
|
-
this._readAuthenticationTrustedDomainsResult = ( new WindowIdleValue(
|
|
47
|
+
this._readAuthenticationTrustedDomainsResult = ( (new WindowIdleValue(
|
|
47
48
|
mainWindow,
|
|
48
49
|
() => this._instantiationService.invokeFunction(readAuthenticationTrustedDomains)
|
|
49
|
-
));
|
|
50
|
+
)));
|
|
50
51
|
});
|
|
51
|
-
this._readWorkspaceTrustedDomainsResult = ( new WindowIdleValue(
|
|
52
|
+
this._readWorkspaceTrustedDomainsResult = ( (new WindowIdleValue(
|
|
52
53
|
mainWindow,
|
|
53
54
|
() => this._instantiationService.invokeFunction(readWorkspaceTrustedDomains)
|
|
54
|
-
));
|
|
55
|
+
)));
|
|
55
56
|
this._workspaceContextService.onDidChangeWorkspaceFolders(() => {
|
|
56
57
|
this._readWorkspaceTrustedDomainsResult?.dispose();
|
|
57
|
-
this._readWorkspaceTrustedDomainsResult = ( new WindowIdleValue(
|
|
58
|
+
this._readWorkspaceTrustedDomainsResult = ( (new WindowIdleValue(
|
|
58
59
|
mainWindow,
|
|
59
60
|
() => this._instantiationService.invokeFunction(readWorkspaceTrustedDomains)
|
|
60
|
-
));
|
|
61
|
+
)));
|
|
61
62
|
});
|
|
62
63
|
}
|
|
63
64
|
async validateLink(resource, openOptions) {
|
|
@@ -70,7 +71,7 @@ let OpenerValidatorContributions = class OpenerValidatorContributions {
|
|
|
70
71
|
const originalResource = resource;
|
|
71
72
|
let resourceUri;
|
|
72
73
|
if (typeof resource === 'string') {
|
|
73
|
-
resourceUri = ( URI.parse(resource));
|
|
74
|
+
resourceUri = ( (URI.parse(resource)));
|
|
74
75
|
}
|
|
75
76
|
else {
|
|
76
77
|
resourceUri = resource;
|
|
@@ -97,38 +98,26 @@ let OpenerValidatorContributions = class OpenerValidatorContributions {
|
|
|
97
98
|
const { result } = await this._dialogService.prompt({
|
|
98
99
|
type: Severity$1.Info,
|
|
99
100
|
message: ( localizeWithPath(
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
_moduleId,
|
|
102
|
+
0,
|
|
102
103
|
'Do you want {0} to open the external website?',
|
|
103
104
|
this._productService.nameShort
|
|
104
105
|
)),
|
|
105
106
|
detail: typeof originalResource === 'string' ? originalResource : formattedLink,
|
|
106
107
|
buttons: [
|
|
107
108
|
{
|
|
108
|
-
label: ( localizeWithPath(
|
|
109
|
-
'vs/workbench/contrib/url/browser/trustedDomainsValidator',
|
|
110
|
-
{ key: 'open', comment: ['&& denotes a mnemonic'] },
|
|
111
|
-
'&&Open'
|
|
112
|
-
)),
|
|
109
|
+
label: ( localizeWithPath(_moduleId, 1, '&&Open')),
|
|
113
110
|
run: () => true
|
|
114
111
|
},
|
|
115
112
|
{
|
|
116
|
-
label: ( localizeWithPath(
|
|
117
|
-
'vs/workbench/contrib/url/browser/trustedDomainsValidator',
|
|
118
|
-
{ key: 'copy', comment: ['&& denotes a mnemonic'] },
|
|
119
|
-
'&&Copy'
|
|
120
|
-
)),
|
|
113
|
+
label: ( localizeWithPath(_moduleId, 2, '&&Copy')),
|
|
121
114
|
run: () => {
|
|
122
|
-
this._clipboardService.writeText(typeof originalResource === 'string' ? originalResource : ( resourceUri.toString(true)));
|
|
115
|
+
this._clipboardService.writeText(typeof originalResource === 'string' ? originalResource : ( (resourceUri.toString(true))));
|
|
123
116
|
return false;
|
|
124
117
|
}
|
|
125
118
|
},
|
|
126
119
|
{
|
|
127
|
-
label: ( localizeWithPath(
|
|
128
|
-
'vs/workbench/contrib/url/browser/trustedDomainsValidator',
|
|
129
|
-
{ key: 'configureTrustedDomains', comment: ['&& denotes a mnemonic'] },
|
|
130
|
-
'Configure &&Trusted Domains'
|
|
131
|
-
)),
|
|
120
|
+
label: ( localizeWithPath(_moduleId, 3, 'Configure &&Trusted Domains')),
|
|
132
121
|
run: async () => {
|
|
133
122
|
const pickedDomains = await configureOpenerTrustedDomainsHandler(trustedDomains, domainToOpen, resourceUri, this._quickInputService, this._storageService, this._editorService);
|
|
134
123
|
if (pickedDomains.indexOf('*') !== -1) {
|
|
@@ -149,21 +138,21 @@ let OpenerValidatorContributions = class OpenerValidatorContributions {
|
|
|
149
138
|
}
|
|
150
139
|
}
|
|
151
140
|
};
|
|
152
|
-
OpenerValidatorContributions = ( __decorate([
|
|
153
|
-
( __param(0, IOpenerService)),
|
|
154
|
-
( __param(1, IStorageService)),
|
|
155
|
-
( __param(2, IDialogService)),
|
|
156
|
-
( __param(3, IProductService)),
|
|
157
|
-
( __param(4, IQuickInputService)),
|
|
158
|
-
( __param(5, IEditorService)),
|
|
159
|
-
( __param(6, IClipboardService)),
|
|
160
|
-
( __param(7, ITelemetryService)),
|
|
161
|
-
( __param(8, IInstantiationService)),
|
|
162
|
-
( __param(9, IAuthenticationService)),
|
|
163
|
-
( __param(10, IWorkspaceContextService)),
|
|
164
|
-
( __param(11, IConfigurationService)),
|
|
165
|
-
( __param(12, IWorkspaceTrustManagementService))
|
|
166
|
-
], OpenerValidatorContributions));
|
|
141
|
+
OpenerValidatorContributions = ( (__decorate([
|
|
142
|
+
( (__param(0, IOpenerService))),
|
|
143
|
+
( (__param(1, IStorageService))),
|
|
144
|
+
( (__param(2, IDialogService))),
|
|
145
|
+
( (__param(3, IProductService))),
|
|
146
|
+
( (__param(4, IQuickInputService))),
|
|
147
|
+
( (__param(5, IEditorService))),
|
|
148
|
+
( (__param(6, IClipboardService))),
|
|
149
|
+
( (__param(7, ITelemetryService))),
|
|
150
|
+
( (__param(8, IInstantiationService))),
|
|
151
|
+
( (__param(9, IAuthenticationService))),
|
|
152
|
+
( (__param(10, IWorkspaceContextService))),
|
|
153
|
+
( (__param(11, IConfigurationService))),
|
|
154
|
+
( (__param(12, IWorkspaceTrustManagementService)))
|
|
155
|
+
], OpenerValidatorContributions)));
|
|
167
156
|
const rLocalhost = /^localhost(:\d+)?$/i;
|
|
168
157
|
const r127 = /^127.0.0.1(:\d+)?$/;
|
|
169
158
|
function isLocalhostAuthority(authority) {
|
|
@@ -172,21 +161,27 @@ function isLocalhostAuthority(authority) {
|
|
|
172
161
|
function normalizeURL(url) {
|
|
173
162
|
const caseInsensitiveAuthorities = ['github.com'];
|
|
174
163
|
try {
|
|
175
|
-
const parsed = typeof url === 'string' ? ( URI.parse(url, true)) : url;
|
|
164
|
+
const parsed = typeof url === 'string' ? ( (URI.parse(url, true))) : url;
|
|
176
165
|
if (caseInsensitiveAuthorities.includes(parsed.authority)) {
|
|
177
|
-
return (
|
|
166
|
+
return (
|
|
167
|
+
(parsed.with({ path: parsed.path.toLowerCase() }).toString(true))
|
|
168
|
+
);
|
|
178
169
|
}
|
|
179
170
|
else {
|
|
180
|
-
return (
|
|
171
|
+
return (
|
|
172
|
+
(parsed.toString(true))
|
|
173
|
+
);
|
|
181
174
|
}
|
|
182
175
|
}
|
|
183
176
|
catch {
|
|
184
|
-
return (
|
|
177
|
+
return (
|
|
178
|
+
(url.toString())
|
|
179
|
+
);
|
|
185
180
|
}
|
|
186
181
|
}
|
|
187
182
|
function isURLDomainTrusted(url, trustedDomains) {
|
|
188
|
-
url = ( URI.parse(normalizeURL(url)));
|
|
189
|
-
trustedDomains = ( trustedDomains.map(normalizeURL));
|
|
183
|
+
url = ( (URI.parse(normalizeURL(url))));
|
|
184
|
+
trustedDomains = ( (trustedDomains.map(normalizeURL)));
|
|
190
185
|
if (isLocalhostAuthority(url.authority)) {
|
|
191
186
|
return true;
|
|
192
187
|
}
|