@codingame/monaco-vscode-remote-agent-service-override 3.2.3 → 4.1.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.
Files changed (24) hide show
  1. package/package.json +3 -3
  2. package/remoteAgent.js +9 -9
  3. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
  4. package/override/vs/platform/dialogs/common/dialogs.js +0 -8
  5. package/vscode/src/vs/platform/download/common/downloadIpc.js +0 -18
  6. package/vscode/src/vs/platform/log/common/logIpc.js +0 -26
  7. package/vscode/src/vs/platform/remote/browser/remoteAuthorityResolverService.js +0 -110
  8. package/vscode/src/vs/workbench/contrib/remote/browser/explorerViewItems.js +0 -135
  9. package/vscode/src/vs/workbench/contrib/remote/browser/media/remoteViewlet.css.js +0 -6
  10. package/vscode/src/vs/workbench/contrib/remote/browser/remote.contribution.js +0 -19
  11. package/vscode/src/vs/workbench/contrib/remote/browser/remote.js +0 -831
  12. package/vscode/src/vs/workbench/contrib/remote/browser/remoteConnectionHealth.js +0 -158
  13. package/vscode/src/vs/workbench/contrib/remote/browser/remoteIndicator.js +0 -774
  14. package/vscode/src/vs/workbench/contrib/remote/browser/remoteStartEntry.contribution.js +0 -6
  15. package/vscode/src/vs/workbench/contrib/remote/browser/remoteStartEntry.js +0 -97
  16. package/vscode/src/vs/workbench/contrib/remote/browser/showCandidate.js +0 -35
  17. package/vscode/src/vs/workbench/contrib/remote/browser/tunnelFactory.js +0 -110
  18. package/vscode/src/vs/workbench/contrib/remote/common/remote.contribution.js +0 -515
  19. package/vscode/src/vs/workbench/services/remote/browser/browserRemoteResourceHandler.js +0 -49
  20. package/vscode/src/vs/workbench/services/remote/browser/remoteAgentService.js +0 -78
  21. package/vscode/src/vs/workbench/services/remote/common/abstractRemoteAgentService.js +0 -179
  22. package/vscode/src/vs/workbench/services/remote/common/remoteAgentEnvironmentChannel.js +0 -54
  23. package/vscode/src/vs/workbench/services/remote/common/remoteExtensionsScanner.js +0 -73
  24. package/vscode/src/vs/workbench/services/tunnel/browser/tunnelService.js +0 -36
@@ -1,831 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import './media/remoteViewlet.css.js';
3
- import { localize2WithPath, localizeWithPath } from 'vscode/vscode/vs/nls';
4
- import { append, $, disposableWindowInterval } from 'vscode/vscode/vs/base/browser/dom';
5
- import { URI } from 'vscode/vscode/vs/base/common/uri';
6
- import { IWorkbenchLayoutService } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService';
7
- import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
8
- import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
9
- import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
10
- import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
11
- import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
12
- import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
13
- import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
14
- import { IContextMenuService } from 'vscode/vscode/vs/platform/contextview/browser/contextView';
15
- import { isProposedApiEnabled, IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
16
- import { FilterViewPaneContainer } from 'vscode/vscode/vs/workbench/browser/parts/views/viewsViewlet';
17
- import { VIEWLET_ID } from 'vscode/vscode/vs/workbench/contrib/remote/browser/remoteExplorer';
18
- import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
19
- import { Extensions, IViewDescriptorService } from 'vscode/vscode/vs/workbench/common/views';
20
- import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
21
- import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener';
22
- import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
23
- import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
24
- import { IProgressService } from 'vscode/vscode/vs/platform/progress/common/progress';
25
- import { IRemoteAgentService } from 'vscode/vscode/vs/workbench/services/remote/common/remoteAgentService';
26
- import '../../../../../../../override/vs/platform/dialogs/common/dialogs.js';
27
- import Severity from 'vscode/vscode/vs/base/common/severity';
28
- import { ReloadWindowAction } from 'vscode/vscode/vs/workbench/browser/actions/windowActions';
29
- import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
30
- import { SwitchRemoteViewItem } from './explorerViewItems.js';
31
- import { isStringArray } from 'vscode/vscode/vs/base/common/types';
32
- import { IRemoteExplorerService } from 'vscode/vscode/vs/workbench/services/remote/common/remoteExplorerService';
33
- import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
34
- import { ViewPane } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPane';
35
- import { WorkbenchAsyncDataTree } from 'vscode/vscode/vs/platform/list/browser/listService';
36
- import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
37
- import { Event, Emitter } from 'vscode/vscode/vs/base/common/event';
38
- import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
39
- import { remoteExplorerViewIcon, getStartedIcon, documentationIcon, reviewIssuesIcon, reportIssuesIcon } from 'vscode/vscode/vs/workbench/contrib/remote/browser/remoteIcons';
40
- import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
41
- import { ITimerService } from 'vscode/vscode/vs/workbench/services/timer/browser/timerService';
42
- import { getRemoteName } from 'vscode/vscode/vs/platform/remote/common/remoteHosts';
43
- import { getVirtualWorkspaceLocation } from 'vscode/vscode/vs/platform/workspace/common/virtualWorkspace';
44
- import { IWalkthroughsService } from 'vscode/vscode/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedService';
45
- import { Schemas } from 'vscode/vscode/vs/base/common/network';
46
- import { mainWindow } from 'vscode/vscode/vs/base/browser/window';
47
- import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';
48
-
49
- class HelpTreeVirtualDelegate {
50
- getHeight(element) {
51
- return 22;
52
- }
53
- getTemplateId(element) {
54
- return 'HelpItemTemplate';
55
- }
56
- }
57
- class HelpTreeRenderer {
58
- constructor() {
59
- this.templateId = 'HelpItemTemplate';
60
- }
61
- renderTemplate(container) {
62
- container.classList.add('remote-help-tree-node-item');
63
- const icon = append(container, $('.remote-help-tree-node-item-icon'));
64
- const parent = container;
65
- return { parent, icon };
66
- }
67
- renderElement(element, index, templateData, height) {
68
- const container = templateData.parent;
69
- append(container, templateData.icon);
70
- templateData.icon.classList.add(...element.element.iconClasses);
71
- const labelContainer = append(container, $('.help-item-label'));
72
- labelContainer.innerText = element.element.label;
73
- }
74
- disposeTemplate(templateData) {
75
- }
76
- }
77
- class HelpDataSource {
78
- hasChildren(element) {
79
- return element instanceof HelpModel;
80
- }
81
- getChildren(element) {
82
- if (element instanceof HelpModel && element.items) {
83
- return element.items;
84
- }
85
- return [];
86
- }
87
- }
88
- class HelpModel {
89
- constructor(viewModel, openerService, quickInputService, commandService, remoteExplorerService, environmentService, workspaceContextService, walkthroughsService) {
90
- this.viewModel = viewModel;
91
- this.openerService = openerService;
92
- this.quickInputService = quickInputService;
93
- this.commandService = commandService;
94
- this.remoteExplorerService = remoteExplorerService;
95
- this.environmentService = environmentService;
96
- this.workspaceContextService = workspaceContextService;
97
- this.walkthroughsService = walkthroughsService;
98
- this.updateItems();
99
- viewModel.onDidChangeHelpInformation(() => this.updateItems());
100
- }
101
- createHelpItemValue(info, infoKey) {
102
- return ( new HelpItemValue(
103
- this.commandService,
104
- this.walkthroughsService,
105
- info.extensionDescription,
106
- (typeof info.remoteName === 'string') ? [info.remoteName] : info.remoteName,
107
- info.virtualWorkspace,
108
- info[infoKey]
109
- ));
110
- }
111
- updateItems() {
112
- const helpItems = [];
113
- const getStarted = this.viewModel.helpInformation.filter(info => info.getStarted);
114
- if (getStarted.length) {
115
- const helpItemValues = ( getStarted.map((info) => this.createHelpItemValue(info, 'getStarted')));
116
- const getStartedHelpItem = this.items?.find(item => item.icon === getStartedIcon) ?? ( new GetStartedHelpItem(getStartedIcon, ( localizeWithPath(
117
- 'vs/workbench/contrib/remote/browser/remote',
118
- 'remote.help.getStarted',
119
- "Get Started"
120
- )), helpItemValues, this.quickInputService, this.environmentService, this.openerService, this.remoteExplorerService, this.workspaceContextService, this.commandService));
121
- getStartedHelpItem.values = helpItemValues;
122
- helpItems.push(getStartedHelpItem);
123
- }
124
- const documentation = this.viewModel.helpInformation.filter(info => info.documentation);
125
- if (documentation.length) {
126
- const helpItemValues = ( documentation.map((info) => this.createHelpItemValue(info, 'documentation')));
127
- const documentationHelpItem = this.items?.find(item => item.icon === documentationIcon) ?? ( new HelpItem(documentationIcon, ( localizeWithPath(
128
- 'vs/workbench/contrib/remote/browser/remote',
129
- 'remote.help.documentation',
130
- "Read Documentation"
131
- )), helpItemValues, this.quickInputService, this.environmentService, this.openerService, this.remoteExplorerService, this.workspaceContextService));
132
- documentationHelpItem.values = helpItemValues;
133
- helpItems.push(documentationHelpItem);
134
- }
135
- const issues = this.viewModel.helpInformation.filter(info => info.issues);
136
- if (issues.length) {
137
- const helpItemValues = ( issues.map((info) => this.createHelpItemValue(info, 'issues')));
138
- const reviewIssuesHelpItem = this.items?.find(item => item.icon === reviewIssuesIcon) ?? ( new HelpItem(reviewIssuesIcon, ( localizeWithPath(
139
- 'vs/workbench/contrib/remote/browser/remote',
140
- 'remote.help.issues',
141
- "Review Issues"
142
- )), helpItemValues, this.quickInputService, this.environmentService, this.openerService, this.remoteExplorerService, this.workspaceContextService));
143
- reviewIssuesHelpItem.values = helpItemValues;
144
- helpItems.push(reviewIssuesHelpItem);
145
- }
146
- if (helpItems.length) {
147
- const helpItemValues = ( this.viewModel.helpInformation.map(info => this.createHelpItemValue(info, 'reportIssue')));
148
- const issueReporterItem = this.items?.find(item => item.icon === reportIssuesIcon) ?? ( new IssueReporterItem(reportIssuesIcon, ( localizeWithPath(
149
- 'vs/workbench/contrib/remote/browser/remote',
150
- 'remote.help.report',
151
- "Report Issue"
152
- )), helpItemValues, this.quickInputService, this.environmentService, this.commandService, this.openerService, this.remoteExplorerService, this.workspaceContextService));
153
- issueReporterItem.values = helpItemValues;
154
- helpItems.push(issueReporterItem);
155
- }
156
- if (helpItems.length) {
157
- this.items = helpItems;
158
- }
159
- }
160
- }
161
- class HelpItemValue {
162
- constructor(commandService, walkthroughService, extensionDescription, remoteAuthority, virtualWorkspace, urlOrCommandOrId) {
163
- this.commandService = commandService;
164
- this.walkthroughService = walkthroughService;
165
- this.extensionDescription = extensionDescription;
166
- this.remoteAuthority = remoteAuthority;
167
- this.virtualWorkspace = virtualWorkspace;
168
- this.urlOrCommandOrId = urlOrCommandOrId;
169
- }
170
- get description() {
171
- return this.getUrl().then(() => this._description);
172
- }
173
- get url() {
174
- return this.getUrl();
175
- }
176
- async getUrl() {
177
- if (this._url === undefined) {
178
- if (typeof this.urlOrCommandOrId === 'string') {
179
- const url = ( URI.parse(this.urlOrCommandOrId));
180
- if (url.authority) {
181
- this._url = this.urlOrCommandOrId;
182
- }
183
- else {
184
- const urlCommand = this.commandService.executeCommand(this.urlOrCommandOrId).then((result) => {
185
- this._url = result;
186
- return this._url;
187
- });
188
- const emptyString = ( new Promise(resolve => setTimeout(() => resolve(''), 500)));
189
- this._url = await Promise.race([urlCommand, emptyString]);
190
- }
191
- }
192
- else if (this.urlOrCommandOrId?.id) {
193
- try {
194
- const walkthroughId = `${this.extensionDescription.id}#${this.urlOrCommandOrId.id}`;
195
- const walkthrough = await this.walkthroughService.getWalkthrough(walkthroughId);
196
- this._description = walkthrough.title;
197
- this._url = walkthroughId;
198
- }
199
- catch { }
200
- }
201
- }
202
- if (this._url === undefined) {
203
- this._url = '';
204
- }
205
- return this._url;
206
- }
207
- }
208
- class HelpItemBase {
209
- constructor(icon, label, values, quickInputService, environmentService, remoteExplorerService, workspaceContextService) {
210
- this.icon = icon;
211
- this.label = label;
212
- this.values = values;
213
- this.quickInputService = quickInputService;
214
- this.environmentService = environmentService;
215
- this.remoteExplorerService = remoteExplorerService;
216
- this.workspaceContextService = workspaceContextService;
217
- this.iconClasses = [];
218
- this.iconClasses.push(...ThemeIcon.asClassNameArray(icon));
219
- this.iconClasses.push('remote-help-tree-node-item-icon');
220
- }
221
- async getActions() {
222
- return (await Promise.all(( this.values.map(async (value) => {
223
- return {
224
- label: value.extensionDescription.displayName || value.extensionDescription.identifier.value,
225
- description: (await value.description) ?? (await value.url),
226
- url: await value.url,
227
- extensionDescription: value.extensionDescription
228
- };
229
- })))).filter(item => item.description);
230
- }
231
- async handleClick() {
232
- const remoteAuthority = this.environmentService.remoteAuthority;
233
- if (remoteAuthority) {
234
- for (let i = 0; i < this.remoteExplorerService.targetType.length; i++) {
235
- if (remoteAuthority.startsWith(this.remoteExplorerService.targetType[i])) {
236
- for (const value of this.values) {
237
- if (value.remoteAuthority) {
238
- for (const authority of value.remoteAuthority) {
239
- if (remoteAuthority.startsWith(authority)) {
240
- await this.takeAction(value.extensionDescription, await value.url);
241
- return;
242
- }
243
- }
244
- }
245
- }
246
- }
247
- }
248
- }
249
- else {
250
- const virtualWorkspace = getVirtualWorkspaceLocation(this.workspaceContextService.getWorkspace())?.scheme;
251
- if (virtualWorkspace) {
252
- for (let i = 0; i < this.remoteExplorerService.targetType.length; i++) {
253
- for (const value of this.values) {
254
- if (value.virtualWorkspace && value.remoteAuthority) {
255
- for (const authority of value.remoteAuthority) {
256
- if (this.remoteExplorerService.targetType[i].startsWith(authority) && virtualWorkspace.startsWith(value.virtualWorkspace)) {
257
- await this.takeAction(value.extensionDescription, await value.url);
258
- return;
259
- }
260
- }
261
- }
262
- }
263
- }
264
- }
265
- }
266
- if (this.values.length > 1) {
267
- const actions = await this.getActions();
268
- if (actions.length) {
269
- const action = await this.quickInputService.pick(actions, { placeHolder: ( localizeWithPath(
270
- 'vs/workbench/contrib/remote/browser/remote',
271
- 'pickRemoteExtension',
272
- "Select url to open"
273
- )) });
274
- if (action) {
275
- await this.takeAction(action.extensionDescription, action.url);
276
- }
277
- }
278
- }
279
- else {
280
- await this.takeAction(this.values[0].extensionDescription, await this.values[0].url);
281
- }
282
- }
283
- }
284
- class GetStartedHelpItem extends HelpItemBase {
285
- constructor(icon, label, values, quickInputService, environmentService, openerService, remoteExplorerService, workspaceContextService, commandService) {
286
- super(icon, label, values, quickInputService, environmentService, remoteExplorerService, workspaceContextService);
287
- this.openerService = openerService;
288
- this.commandService = commandService;
289
- }
290
- async takeAction(extensionDescription, urlOrWalkthroughId) {
291
- if ([Schemas.http, Schemas.https].includes(( URI.parse(urlOrWalkthroughId)).scheme)) {
292
- this.openerService.open(urlOrWalkthroughId, { allowCommands: true });
293
- return;
294
- }
295
- this.commandService.executeCommand('workbench.action.openWalkthrough', urlOrWalkthroughId);
296
- }
297
- }
298
- class HelpItem extends HelpItemBase {
299
- constructor(icon, label, values, quickInputService, environmentService, openerService, remoteExplorerService, workspaceContextService) {
300
- super(icon, label, values, quickInputService, environmentService, remoteExplorerService, workspaceContextService);
301
- this.openerService = openerService;
302
- }
303
- async takeAction(extensionDescription, url) {
304
- await this.openerService.open(( URI.parse(url)), { allowCommands: true });
305
- }
306
- }
307
- class IssueReporterItem extends HelpItemBase {
308
- constructor(icon, label, values, quickInputService, environmentService, commandService, openerService, remoteExplorerService, workspaceContextService) {
309
- super(icon, label, values, quickInputService, environmentService, remoteExplorerService, workspaceContextService);
310
- this.commandService = commandService;
311
- this.openerService = openerService;
312
- }
313
- async getActions() {
314
- return Promise.all(( this.values.map(async (value) => {
315
- return {
316
- label: value.extensionDescription.displayName || value.extensionDescription.identifier.value,
317
- description: '',
318
- url: await value.url,
319
- extensionDescription: value.extensionDescription
320
- };
321
- })));
322
- }
323
- async takeAction(extensionDescription, url) {
324
- if (!url) {
325
- await this.commandService.executeCommand('workbench.action.openIssueReporter', [extensionDescription.identifier.value]);
326
- }
327
- else {
328
- await this.openerService.open(( URI.parse(url)));
329
- }
330
- }
331
- }
332
- let HelpPanel = class HelpPanel extends ViewPane {
333
- static { this.ID = '~remote.helpPanel'; }
334
- static { this.TITLE = ( localize2WithPath(
335
- 'vs/workbench/contrib/remote/browser/remote',
336
- 'remote.help',
337
- "Help and feedback"
338
- )); }
339
- constructor(viewModel, options, keybindingService, contextMenuService, contextKeyService, configurationService, instantiationService, viewDescriptorService, openerService, quickInputService, commandService, remoteExplorerService, environmentService, themeService, telemetryService, workspaceContextService, walkthroughsService) {
340
- super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
341
- this.viewModel = viewModel;
342
- this.quickInputService = quickInputService;
343
- this.commandService = commandService;
344
- this.remoteExplorerService = remoteExplorerService;
345
- this.environmentService = environmentService;
346
- this.workspaceContextService = workspaceContextService;
347
- this.walkthroughsService = walkthroughsService;
348
- }
349
- renderBody(container) {
350
- super.renderBody(container);
351
- container.classList.add('remote-help');
352
- const treeContainer = document.createElement('div');
353
- treeContainer.classList.add('remote-help-content');
354
- container.appendChild(treeContainer);
355
- this.tree = this.instantiationService.createInstance(WorkbenchAsyncDataTree, 'RemoteHelp', treeContainer, ( new HelpTreeVirtualDelegate()), [( new HelpTreeRenderer())], ( new HelpDataSource()), {
356
- accessibilityProvider: {
357
- getAriaLabel: (item) => {
358
- return item.label;
359
- },
360
- getWidgetAriaLabel: () => ( localizeWithPath('vs/workbench/contrib/remote/browser/remote', 'remotehelp', "Remote Help"))
361
- }
362
- });
363
- const model = ( new HelpModel(
364
- this.viewModel,
365
- this.openerService,
366
- this.quickInputService,
367
- this.commandService,
368
- this.remoteExplorerService,
369
- this.environmentService,
370
- this.workspaceContextService,
371
- this.walkthroughsService
372
- ));
373
- this.tree.setInput(model);
374
- this._register(Event.debounce(this.tree.onDidOpen, (last, event) => event, 75, true)(e => {
375
- e.element?.handleClick();
376
- }));
377
- }
378
- layoutBody(height, width) {
379
- super.layoutBody(height, width);
380
- this.tree.layout(height, width);
381
- }
382
- };
383
- HelpPanel = ( __decorate([
384
- ( __param(2, IKeybindingService)),
385
- ( __param(3, IContextMenuService)),
386
- ( __param(4, IContextKeyService)),
387
- ( __param(5, IConfigurationService)),
388
- ( __param(6, IInstantiationService)),
389
- ( __param(7, IViewDescriptorService)),
390
- ( __param(8, IOpenerService)),
391
- ( __param(9, IQuickInputService)),
392
- ( __param(10, ICommandService)),
393
- ( __param(11, IRemoteExplorerService)),
394
- ( __param(12, IWorkbenchEnvironmentService)),
395
- ( __param(13, IThemeService)),
396
- ( __param(14, ITelemetryService)),
397
- ( __param(15, IWorkspaceContextService)),
398
- ( __param(16, IWalkthroughsService))
399
- ], HelpPanel));
400
- class HelpPanelDescriptor {
401
- constructor(viewModel) {
402
- this.id = HelpPanel.ID;
403
- this.name = HelpPanel.TITLE;
404
- this.canToggleVisibility = true;
405
- this.hideByDefault = false;
406
- this.group = 'help@50';
407
- this.order = -10;
408
- this.ctorDescriptor = ( new SyncDescriptor(HelpPanel, [viewModel]));
409
- }
410
- }
411
- let RemoteViewPaneContainer = class RemoteViewPaneContainer extends FilterViewPaneContainer {
412
- constructor(layoutService, telemetryService, contextService, storageService, configurationService, instantiationService, themeService, contextMenuService, extensionService, remoteExplorerService, viewDescriptorService) {
413
- super(VIEWLET_ID, remoteExplorerService.onDidChangeTargetType, configurationService, layoutService, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService, viewDescriptorService);
414
- this.remoteExplorerService = remoteExplorerService;
415
- this.helpPanelDescriptor = ( new HelpPanelDescriptor(this));
416
- this.helpInformation = [];
417
- this._onDidChangeHelpInformation = ( new Emitter());
418
- this.onDidChangeHelpInformation = this._onDidChangeHelpInformation.event;
419
- this.hasRegisteredHelpView = false;
420
- this.addConstantViewDescriptors([this.helpPanelDescriptor]);
421
- this._register(this.remoteSwitcher = this.instantiationService.createInstance(SwitchRemoteViewItem));
422
- this.remoteExplorerService.onDidChangeHelpInformation(extensions => {
423
- this._setHelpInformation(extensions);
424
- });
425
- this._setHelpInformation(this.remoteExplorerService.helpInformation);
426
- const viewsRegistry = ( Registry.as(Extensions.ViewsRegistry));
427
- this.remoteSwitcher.createOptionItems(viewsRegistry.getViews(this.viewContainer));
428
- this._register(viewsRegistry.onViewsRegistered(e => {
429
- const remoteViews = [];
430
- for (const view of e) {
431
- if (view.viewContainer.id === VIEWLET_ID) {
432
- remoteViews.push(...view.views);
433
- }
434
- }
435
- if (remoteViews.length > 0) {
436
- this.remoteSwitcher.createOptionItems(remoteViews);
437
- }
438
- }));
439
- this._register(viewsRegistry.onViewsDeregistered(e => {
440
- if (e.viewContainer.id === VIEWLET_ID) {
441
- this.remoteSwitcher.removeOptionItems(e.views);
442
- }
443
- }));
444
- }
445
- _setHelpInformation(extensions) {
446
- const helpInformation = [];
447
- for (const extension of extensions) {
448
- this._handleRemoteInfoExtensionPoint(extension, helpInformation);
449
- }
450
- this.helpInformation = helpInformation;
451
- this._onDidChangeHelpInformation.fire();
452
- const viewsRegistry = ( Registry.as(Extensions.ViewsRegistry));
453
- if (this.helpInformation.length && !this.hasRegisteredHelpView) {
454
- const view = viewsRegistry.getView(this.helpPanelDescriptor.id);
455
- if (!view) {
456
- viewsRegistry.registerViews([this.helpPanelDescriptor], this.viewContainer);
457
- }
458
- this.hasRegisteredHelpView = true;
459
- }
460
- else if (this.hasRegisteredHelpView) {
461
- viewsRegistry.deregisterViews([this.helpPanelDescriptor], this.viewContainer);
462
- this.hasRegisteredHelpView = false;
463
- }
464
- }
465
- _handleRemoteInfoExtensionPoint(extension, helpInformation) {
466
- if (!isProposedApiEnabled(extension.description, 'contribRemoteHelp')) {
467
- return;
468
- }
469
- if (!extension.value.documentation && !extension.value.getStarted && !extension.value.issues) {
470
- return;
471
- }
472
- helpInformation.push({
473
- extensionDescription: extension.description,
474
- getStarted: extension.value.getStarted,
475
- documentation: extension.value.documentation,
476
- reportIssue: extension.value.reportIssue,
477
- issues: extension.value.issues,
478
- remoteName: extension.value.remoteName,
479
- virtualWorkspace: extension.value.virtualWorkspace
480
- });
481
- }
482
- getFilterOn(viewDescriptor) {
483
- return isStringArray(viewDescriptor.remoteAuthority) ? viewDescriptor.remoteAuthority[0] : viewDescriptor.remoteAuthority;
484
- }
485
- setFilter(viewDescriptor) {
486
- this.remoteExplorerService.targetType = isStringArray(viewDescriptor.remoteAuthority) ? viewDescriptor.remoteAuthority : [viewDescriptor.remoteAuthority];
487
- }
488
- getTitle() {
489
- const title = ( localizeWithPath(
490
- 'vs/workbench/contrib/remote/browser/remote',
491
- 'remote.explorer',
492
- "Remote Explorer"
493
- ));
494
- return title;
495
- }
496
- };
497
- RemoteViewPaneContainer = ( __decorate([
498
- ( __param(0, IWorkbenchLayoutService)),
499
- ( __param(1, ITelemetryService)),
500
- ( __param(2, IWorkspaceContextService)),
501
- ( __param(3, IStorageService)),
502
- ( __param(4, IConfigurationService)),
503
- ( __param(5, IInstantiationService)),
504
- ( __param(6, IThemeService)),
505
- ( __param(7, IContextMenuService)),
506
- ( __param(8, IExtensionService)),
507
- ( __param(9, IRemoteExplorerService)),
508
- ( __param(10, IViewDescriptorService))
509
- ], RemoteViewPaneContainer));
510
- ( Registry.as(Extensions.ViewContainersRegistry)).registerViewContainer({
511
- id: VIEWLET_ID,
512
- title: ( localize2WithPath(
513
- 'vs/workbench/contrib/remote/browser/remote',
514
- 'remote.explorer',
515
- "Remote Explorer"
516
- )),
517
- ctorDescriptor: ( new SyncDescriptor(RemoteViewPaneContainer)),
518
- hideIfEmpty: true,
519
- viewOrderDelegate: {
520
- getOrder: (group) => {
521
- if (!group) {
522
- return;
523
- }
524
- let matches = /^targets@(\d+)$/.exec(group);
525
- if (matches) {
526
- return -1000;
527
- }
528
- matches = /^details(@(\d+))?$/.exec(group);
529
- if (matches) {
530
- return -500 + Number(matches[2]);
531
- }
532
- matches = /^help(@(\d+))?$/.exec(group);
533
- if (matches) {
534
- return -10;
535
- }
536
- return;
537
- }
538
- },
539
- icon: remoteExplorerViewIcon,
540
- order: 4
541
- }, 0 );
542
- let RemoteMarkers = class RemoteMarkers {
543
- constructor(remoteAgentService, timerService) {
544
- remoteAgentService.getEnvironment().then(remoteEnv => {
545
- if (remoteEnv) {
546
- timerService.setPerformanceMarks('server', remoteEnv.marks);
547
- }
548
- });
549
- }
550
- };
551
- RemoteMarkers = ( __decorate([
552
- ( __param(0, IRemoteAgentService)),
553
- ( __param(1, ITimerService))
554
- ], RemoteMarkers));
555
- class VisibleProgress {
556
- get lastReport() {
557
- return this._lastReport;
558
- }
559
- constructor(progressService, location, initialReport, buttons, onDidCancel) {
560
- this.location = location;
561
- this._isDisposed = false;
562
- this._lastReport = initialReport;
563
- this._currentProgressPromiseResolve = null;
564
- this._currentProgress = null;
565
- this._currentTimer = null;
566
- const promise = ( new Promise((resolve) => this._currentProgressPromiseResolve = resolve));
567
- progressService.withProgress({ location: location, buttons: buttons }, (progress) => { if (!this._isDisposed) {
568
- this._currentProgress = progress;
569
- } return promise; }, (choice) => onDidCancel(choice, this._lastReport));
570
- if (this._lastReport) {
571
- this.report();
572
- }
573
- }
574
- dispose() {
575
- this._isDisposed = true;
576
- if (this._currentProgressPromiseResolve) {
577
- this._currentProgressPromiseResolve();
578
- this._currentProgressPromiseResolve = null;
579
- }
580
- this._currentProgress = null;
581
- if (this._currentTimer) {
582
- this._currentTimer.dispose();
583
- this._currentTimer = null;
584
- }
585
- }
586
- report(message) {
587
- if (message) {
588
- this._lastReport = message;
589
- }
590
- if (this._lastReport && this._currentProgress) {
591
- this._currentProgress.report({ message: this._lastReport });
592
- }
593
- }
594
- startTimer(completionTime) {
595
- this.stopTimer();
596
- this._currentTimer = ( new ReconnectionTimer(this, completionTime));
597
- }
598
- stopTimer() {
599
- if (this._currentTimer) {
600
- this._currentTimer.dispose();
601
- this._currentTimer = null;
602
- }
603
- }
604
- }
605
- class ReconnectionTimer {
606
- constructor(parent, completionTime) {
607
- this._parent = parent;
608
- this._completionTime = completionTime;
609
- this._renderInterval = disposableWindowInterval(mainWindow, () => this._render(), 1000);
610
- this._render();
611
- }
612
- dispose() {
613
- this._renderInterval.dispose();
614
- }
615
- _render() {
616
- const remainingTimeMs = this._completionTime - Date.now();
617
- if (remainingTimeMs < 0) {
618
- return;
619
- }
620
- const remainingTime = Math.ceil(remainingTimeMs / 1000);
621
- if (remainingTime === 1) {
622
- this._parent.report(( localizeWithPath(
623
- 'vs/workbench/contrib/remote/browser/remote',
624
- 'reconnectionWaitOne',
625
- "Attempting to reconnect in {0} second...",
626
- remainingTime
627
- )));
628
- }
629
- else {
630
- this._parent.report(( localizeWithPath(
631
- 'vs/workbench/contrib/remote/browser/remote',
632
- 'reconnectionWaitMany',
633
- "Attempting to reconnect in {0} seconds...",
634
- remainingTime
635
- )));
636
- }
637
- }
638
- }
639
- const DISCONNECT_PROMPT_TIME = 40 * 1000;
640
- let RemoteAgentConnectionStatusListener = class RemoteAgentConnectionStatusListener extends Disposable {
641
- constructor(remoteAgentService, progressService, dialogService, commandService, quickInputService, logService, environmentService, telemetryService) {
642
- super();
643
- this._reloadWindowShown = false;
644
- const connection = remoteAgentService.getConnection();
645
- if (connection) {
646
- let quickInputVisible = false;
647
- quickInputService.onShow(() => quickInputVisible = true);
648
- quickInputService.onHide(() => quickInputVisible = false);
649
- let visibleProgress = null;
650
- let reconnectWaitEvent = null;
651
- let disposableListener = null;
652
- function showProgress(location, buttons, initialReport = null) {
653
- if (visibleProgress) {
654
- visibleProgress.dispose();
655
- visibleProgress = null;
656
- }
657
- if (!location) {
658
- location = quickInputVisible ? 15 : 20 ;
659
- }
660
- return ( new VisibleProgress(progressService, location, initialReport, ( buttons.map(button => button.label)), (choice, lastReport) => {
661
- if (typeof choice !== 'undefined' && buttons[choice]) {
662
- buttons[choice].callback();
663
- }
664
- else {
665
- if (location === 20 ) {
666
- visibleProgress = showProgress(15 , buttons, lastReport);
667
- }
668
- else {
669
- hideProgress();
670
- }
671
- }
672
- }));
673
- }
674
- function hideProgress() {
675
- if (visibleProgress) {
676
- visibleProgress.dispose();
677
- visibleProgress = null;
678
- }
679
- }
680
- let reconnectionToken = '';
681
- let lastIncomingDataTime = 0;
682
- let reconnectionAttempts = 0;
683
- const reconnectButton = {
684
- label: ( localizeWithPath(
685
- 'vs/workbench/contrib/remote/browser/remote',
686
- 'reconnectNow',
687
- "Reconnect Now"
688
- )),
689
- callback: () => {
690
- reconnectWaitEvent?.skipWait();
691
- }
692
- };
693
- const reloadButton = {
694
- label: ( localizeWithPath(
695
- 'vs/workbench/contrib/remote/browser/remote',
696
- 'reloadWindow',
697
- "Reload Window"
698
- )),
699
- callback: () => {
700
- telemetryService.publicLog2('remoteReconnectionReload', {
701
- remoteName: getRemoteName(environmentService.remoteAuthority),
702
- reconnectionToken: reconnectionToken,
703
- millisSinceLastIncomingData: Date.now() - lastIncomingDataTime,
704
- attempt: reconnectionAttempts
705
- });
706
- commandService.executeCommand(ReloadWindowAction.ID);
707
- }
708
- };
709
- connection.onDidStateChange((e) => {
710
- visibleProgress?.stopTimer();
711
- if (disposableListener) {
712
- disposableListener.dispose();
713
- disposableListener = null;
714
- }
715
- switch (e.type) {
716
- case 0 :
717
- reconnectionToken = e.reconnectionToken;
718
- lastIncomingDataTime = Date.now() - e.millisSinceLastIncomingData;
719
- reconnectionAttempts = 0;
720
- telemetryService.publicLog2('remoteConnectionLost', {
721
- remoteName: getRemoteName(environmentService.remoteAuthority),
722
- reconnectionToken: e.reconnectionToken,
723
- });
724
- if (visibleProgress || e.millisSinceLastIncomingData > DISCONNECT_PROMPT_TIME) {
725
- if (!visibleProgress) {
726
- visibleProgress = showProgress(null, [reconnectButton, reloadButton]);
727
- }
728
- visibleProgress.report(( localizeWithPath(
729
- 'vs/workbench/contrib/remote/browser/remote',
730
- 'connectionLost',
731
- "Connection Lost"
732
- )));
733
- }
734
- break;
735
- case 1 :
736
- if (visibleProgress) {
737
- reconnectWaitEvent = e;
738
- visibleProgress = showProgress(null, [reconnectButton, reloadButton]);
739
- visibleProgress.startTimer(Date.now() + 1000 * e.durationSeconds);
740
- }
741
- break;
742
- case 2 :
743
- reconnectionToken = e.reconnectionToken;
744
- lastIncomingDataTime = Date.now() - e.millisSinceLastIncomingData;
745
- reconnectionAttempts = e.attempt;
746
- telemetryService.publicLog2('remoteReconnectionRunning', {
747
- remoteName: getRemoteName(environmentService.remoteAuthority),
748
- reconnectionToken: e.reconnectionToken,
749
- millisSinceLastIncomingData: e.millisSinceLastIncomingData,
750
- attempt: e.attempt
751
- });
752
- if (visibleProgress || e.millisSinceLastIncomingData > DISCONNECT_PROMPT_TIME) {
753
- visibleProgress = showProgress(null, [reloadButton]);
754
- visibleProgress.report(( localizeWithPath(
755
- 'vs/workbench/contrib/remote/browser/remote',
756
- 'reconnectionRunning',
757
- "Disconnected. Attempting to reconnect..."
758
- )));
759
- disposableListener = quickInputService.onShow(() => {
760
- if (visibleProgress && visibleProgress.location === 20 ) {
761
- visibleProgress = showProgress(15 , [reloadButton], visibleProgress.lastReport);
762
- }
763
- });
764
- }
765
- break;
766
- case 3 :
767
- reconnectionToken = e.reconnectionToken;
768
- lastIncomingDataTime = Date.now() - e.millisSinceLastIncomingData;
769
- reconnectionAttempts = e.attempt;
770
- telemetryService.publicLog2('remoteReconnectionPermanentFailure', {
771
- remoteName: getRemoteName(environmentService.remoteAuthority),
772
- reconnectionToken: e.reconnectionToken,
773
- millisSinceLastIncomingData: e.millisSinceLastIncomingData,
774
- attempt: e.attempt,
775
- handled: e.handled
776
- });
777
- hideProgress();
778
- if (e.handled) {
779
- logService.info(`Error handled: Not showing a notification for the error.`);
780
- console.log(`Error handled: Not showing a notification for the error.`);
781
- }
782
- else if (!this._reloadWindowShown) {
783
- this._reloadWindowShown = true;
784
- dialogService.confirm({
785
- type: Severity.Error,
786
- message: ( localizeWithPath(
787
- 'vs/workbench/contrib/remote/browser/remote',
788
- 'reconnectionPermanentFailure',
789
- "Cannot reconnect. Please reload the window."
790
- )),
791
- primaryButton: ( localizeWithPath(
792
- 'vs/workbench/contrib/remote/browser/remote',
793
- { key: 'reloadWindow.dialog', comment: ['&& denotes a mnemonic'] },
794
- "&&Reload Window"
795
- ))
796
- }).then(result => {
797
- if (result.confirmed) {
798
- commandService.executeCommand(ReloadWindowAction.ID);
799
- }
800
- });
801
- }
802
- break;
803
- case 4 :
804
- reconnectionToken = e.reconnectionToken;
805
- lastIncomingDataTime = Date.now() - e.millisSinceLastIncomingData;
806
- reconnectionAttempts = e.attempt;
807
- telemetryService.publicLog2('remoteConnectionGain', {
808
- remoteName: getRemoteName(environmentService.remoteAuthority),
809
- reconnectionToken: e.reconnectionToken,
810
- millisSinceLastIncomingData: e.millisSinceLastIncomingData,
811
- attempt: e.attempt
812
- });
813
- hideProgress();
814
- break;
815
- }
816
- });
817
- }
818
- }
819
- };
820
- RemoteAgentConnectionStatusListener = ( __decorate([
821
- ( __param(0, IRemoteAgentService)),
822
- ( __param(1, IProgressService)),
823
- ( __param(2, IDialogService)),
824
- ( __param(3, ICommandService)),
825
- ( __param(4, IQuickInputService)),
826
- ( __param(5, ILogService)),
827
- ( __param(6, IWorkbenchEnvironmentService)),
828
- ( __param(7, ITelemetryService))
829
- ], RemoteAgentConnectionStatusListener));
830
-
831
- export { RemoteAgentConnectionStatusListener, RemoteMarkers };