@codingame/monaco-vscode-remote-agent-service-override 4.1.0 → 4.1.2
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/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
- package/override/vs/platform/dialogs/common/dialogs.js +10 -0
- package/package.json +3 -3
- package/remoteAgent.js +8 -8
- package/vscode/src/vs/platform/download/common/downloadIpc.js +18 -0
- package/vscode/src/vs/platform/log/common/logIpc.js +28 -0
- package/vscode/src/vs/platform/remote/browser/remoteAuthorityResolverService.js +110 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/explorerViewItems.js +135 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/media/remoteViewlet.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/remote.contribution.js +19 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/remote.js +831 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/remoteConnectionHealth.js +166 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/remoteIndicator.js +802 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/remoteStartEntry.contribution.js +6 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/remoteStartEntry.js +97 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/showCandidate.js +35 -0
- package/vscode/src/vs/workbench/contrib/remote/browser/tunnelFactory.js +110 -0
- package/vscode/src/vs/workbench/contrib/remote/common/remote.contribution.js +515 -0
- package/vscode/src/vs/workbench/services/remote/browser/browserRemoteResourceHandler.js +49 -0
- package/vscode/src/vs/workbench/services/remote/browser/remoteAgentService.js +78 -0
- package/vscode/src/vs/workbench/services/remote/common/abstractRemoteAgentService.js +179 -0
- package/vscode/src/vs/workbench/services/remote/common/remoteAgentEnvironmentChannel.js +54 -0
- package/vscode/src/vs/workbench/services/remote/common/remoteExtensionsScanner.js +73 -0
- package/vscode/src/vs/workbench/services/tunnel/browser/tunnelService.js +36 -0
|
@@ -0,0 +1,802 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { localize2WithPath, localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
3
|
+
import { remoteConnectionLatencyMeasurer, IRemoteAgentService } from 'vscode/vscode/vs/workbench/services/remote/common/remoteAgentService';
|
|
4
|
+
import { RunOnceScheduler, retry } from 'vscode/vscode/vs/base/common/async';
|
|
5
|
+
import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
|
|
6
|
+
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
7
|
+
import { MenuId, registerAction2, Action2, MenuRegistry, MenuItemAction, IMenuService } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
8
|
+
import { IStatusbarService } from 'vscode/vscode/vs/workbench/services/statusbar/browser/statusbar';
|
|
9
|
+
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label';
|
|
10
|
+
import { RawContextKey, ContextKeyExpr, IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
11
|
+
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
|
|
12
|
+
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
13
|
+
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
|
|
14
|
+
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
|
|
15
|
+
import { IBrowserWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/browser/environmentService';
|
|
16
|
+
import { IRemoteAuthorityResolverService } from 'vscode/vscode/vs/platform/remote/common/remoteAuthorityResolver';
|
|
17
|
+
import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host';
|
|
18
|
+
import { isWeb, PlatformToString, platform } from 'vscode/vscode/vs/base/common/platform';
|
|
19
|
+
import { truncate } from 'vscode/vscode/vs/base/common/strings';
|
|
20
|
+
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
21
|
+
import { getRemoteName } from 'vscode/vscode/vs/platform/remote/common/remoteHosts';
|
|
22
|
+
import { getVirtualWorkspaceLocation } from 'vscode/vscode/vs/platform/workspace/common/virtualWorkspace';
|
|
23
|
+
import { getCodiconAriaLabel } from 'vscode/vscode/vs/base/common/iconLabels';
|
|
24
|
+
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
25
|
+
import { ReloadWindowAction } from 'vscode/vscode/vs/workbench/browser/actions/windowActions';
|
|
26
|
+
import { EXTENSION_INSTALL_SKIP_WALKTHROUGH_CONTEXT, IExtensionGalleryService, IExtensionManagementService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
|
|
27
|
+
import { VIEWLET_ID, LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID } from 'vscode/vscode/vs/workbench/contrib/extensions/common/extensions';
|
|
28
|
+
import { MarkdownString } from 'vscode/vscode/vs/base/common/htmlContent';
|
|
29
|
+
import { RemoteNameContext, VirtualWorkspaceContext } from 'vscode/vscode/vs/workbench/common/contextkeys';
|
|
30
|
+
import { IPaneCompositePartService } from 'vscode/vscode/vs/workbench/services/panecomposite/browser/panecomposite';
|
|
31
|
+
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
|
|
32
|
+
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService';
|
|
33
|
+
import { DomEmitter } from 'vscode/vscode/vs/base/browser/event';
|
|
34
|
+
import { ExtensionIdentifier } from 'vscode/vscode/vs/platform/extensions/common/extensions';
|
|
35
|
+
import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
|
|
36
|
+
import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
|
|
37
|
+
import { infoIcon } from 'vscode/vscode/vs/workbench/contrib/extensions/browser/extensionsIcons';
|
|
38
|
+
import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener';
|
|
39
|
+
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
40
|
+
import { mainWindow } from 'vscode/vscode/vs/base/browser/window';
|
|
41
|
+
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
42
|
+
import { Extensions } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
|
|
43
|
+
import { workbenchConfigurationNodeBase } from 'vscode/vscode/vs/workbench/common/configuration';
|
|
44
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
45
|
+
|
|
46
|
+
var RemoteStatusIndicator_1;
|
|
47
|
+
let RemoteStatusIndicator = class RemoteStatusIndicator extends Disposable {
|
|
48
|
+
static { RemoteStatusIndicator_1 = this; }
|
|
49
|
+
static { this.ID = 'workbench.contrib.remoteStatusIndicator'; }
|
|
50
|
+
static { this.REMOTE_ACTIONS_COMMAND_ID = 'workbench.action.remote.showMenu'; }
|
|
51
|
+
static { this.CLOSE_REMOTE_COMMAND_ID = 'workbench.action.remote.close'; }
|
|
52
|
+
static { this.SHOW_CLOSE_REMOTE_COMMAND_ID = !isWeb; }
|
|
53
|
+
static { this.INSTALL_REMOTE_EXTENSIONS_ID = 'workbench.action.remote.extensions'; }
|
|
54
|
+
static { this.REMOTE_STATUS_LABEL_MAX_LENGTH = 40; }
|
|
55
|
+
static { this.REMOTE_CONNECTION_LATENCY_SCHEDULER_DELAY = 60 * 1000; }
|
|
56
|
+
static { this.REMOTE_CONNECTION_LATENCY_SCHEDULER_FIRST_RUN_DELAY = 10 * 1000; }
|
|
57
|
+
get remoteExtensionMetadata() {
|
|
58
|
+
if (!this._remoteExtensionMetadata) {
|
|
59
|
+
const remoteExtensionTips = { ...this.productService.remoteExtensionTips, ...this.productService.virtualWorkspaceExtensionTips };
|
|
60
|
+
this._remoteExtensionMetadata = ( ( Object.values(remoteExtensionTips)).filter(value => value.startEntry !== undefined).map(value => {
|
|
61
|
+
return {
|
|
62
|
+
id: value.extensionId,
|
|
63
|
+
installed: false,
|
|
64
|
+
friendlyName: value.friendlyName,
|
|
65
|
+
isPlatformCompatible: false,
|
|
66
|
+
dependencies: [],
|
|
67
|
+
helpLink: value.startEntry?.helpLink ?? '',
|
|
68
|
+
startConnectLabel: value.startEntry?.startConnectLabel ?? '',
|
|
69
|
+
startCommand: value.startEntry?.startCommand ?? '',
|
|
70
|
+
priority: value.startEntry?.priority ?? 10,
|
|
71
|
+
supportedPlatforms: value.supportedPlatforms
|
|
72
|
+
};
|
|
73
|
+
}));
|
|
74
|
+
this.remoteExtensionMetadata.sort((ext1, ext2) => ext1.priority - ext2.priority);
|
|
75
|
+
}
|
|
76
|
+
return this._remoteExtensionMetadata;
|
|
77
|
+
}
|
|
78
|
+
constructor(statusbarService, environmentService, labelService, contextKeyService, menuService, quickInputService, commandService, extensionService, remoteAgentService, remoteAuthorityResolverService, hostService, workspaceContextService, logService, extensionGalleryService, telemetryService, productService, extensionManagementService, openerService, configurationService) {
|
|
79
|
+
super();
|
|
80
|
+
this.statusbarService = statusbarService;
|
|
81
|
+
this.environmentService = environmentService;
|
|
82
|
+
this.labelService = labelService;
|
|
83
|
+
this.contextKeyService = contextKeyService;
|
|
84
|
+
this.menuService = menuService;
|
|
85
|
+
this.quickInputService = quickInputService;
|
|
86
|
+
this.commandService = commandService;
|
|
87
|
+
this.extensionService = extensionService;
|
|
88
|
+
this.remoteAgentService = remoteAgentService;
|
|
89
|
+
this.remoteAuthorityResolverService = remoteAuthorityResolverService;
|
|
90
|
+
this.hostService = hostService;
|
|
91
|
+
this.workspaceContextService = workspaceContextService;
|
|
92
|
+
this.logService = logService;
|
|
93
|
+
this.extensionGalleryService = extensionGalleryService;
|
|
94
|
+
this.telemetryService = telemetryService;
|
|
95
|
+
this.productService = productService;
|
|
96
|
+
this.extensionManagementService = extensionManagementService;
|
|
97
|
+
this.openerService = openerService;
|
|
98
|
+
this.configurationService = configurationService;
|
|
99
|
+
this.legacyIndicatorMenu = this._register(this.menuService.createMenu(MenuId.StatusBarWindowIndicatorMenu, this.contextKeyService));
|
|
100
|
+
this.remoteIndicatorMenu = this._register(this.menuService.createMenu(MenuId.StatusBarRemoteIndicatorMenu, this.contextKeyService));
|
|
101
|
+
this.remoteAuthority = this.environmentService.remoteAuthority;
|
|
102
|
+
this.virtualWorkspaceLocation = undefined;
|
|
103
|
+
this.connectionState = undefined;
|
|
104
|
+
this.connectionToken = undefined;
|
|
105
|
+
this.connectionStateContextKey = ( new RawContextKey('remoteConnectionState', '')).bindTo(this.contextKeyService);
|
|
106
|
+
this.networkState = undefined;
|
|
107
|
+
this.measureNetworkConnectionLatencyScheduler = undefined;
|
|
108
|
+
this.loggedInvalidGroupNames = Object.create(null);
|
|
109
|
+
this._remoteExtensionMetadata = undefined;
|
|
110
|
+
this.remoteMetadataInitialized = false;
|
|
111
|
+
this._onDidChangeEntries = this._register(( new Emitter()));
|
|
112
|
+
this.onDidChangeEntries = this._onDidChangeEntries.event;
|
|
113
|
+
if (this.remoteAuthority) {
|
|
114
|
+
this.connectionState = 'initializing';
|
|
115
|
+
this.connectionStateContextKey.set(this.connectionState);
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
this.updateVirtualWorkspaceLocation();
|
|
119
|
+
}
|
|
120
|
+
this.registerActions();
|
|
121
|
+
this.registerListeners();
|
|
122
|
+
this.updateWhenInstalledExtensionsRegistered();
|
|
123
|
+
this.updateRemoteStatusIndicator();
|
|
124
|
+
}
|
|
125
|
+
registerActions() {
|
|
126
|
+
const category = ( localize2WithPath(
|
|
127
|
+
'vs/workbench/contrib/remote/browser/remoteIndicator',
|
|
128
|
+
'remote.category',
|
|
129
|
+
"Remote"
|
|
130
|
+
));
|
|
131
|
+
const that = this;
|
|
132
|
+
this._register(registerAction2(class extends Action2 {
|
|
133
|
+
constructor() {
|
|
134
|
+
super({
|
|
135
|
+
id: RemoteStatusIndicator_1.REMOTE_ACTIONS_COMMAND_ID,
|
|
136
|
+
category,
|
|
137
|
+
title: ( localize2WithPath(
|
|
138
|
+
'vs/workbench/contrib/remote/browser/remoteIndicator',
|
|
139
|
+
'remote.showMenu',
|
|
140
|
+
"Show Remote Menu"
|
|
141
|
+
)),
|
|
142
|
+
f1: true,
|
|
143
|
+
keybinding: {
|
|
144
|
+
weight: 200 ,
|
|
145
|
+
primary: 2048 | 512 | 45 ,
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
this.run = () => that.showRemoteMenu();
|
|
149
|
+
}
|
|
150
|
+
}));
|
|
151
|
+
if (RemoteStatusIndicator_1.SHOW_CLOSE_REMOTE_COMMAND_ID) {
|
|
152
|
+
this._register(registerAction2(class extends Action2 {
|
|
153
|
+
constructor() {
|
|
154
|
+
super({
|
|
155
|
+
id: RemoteStatusIndicator_1.CLOSE_REMOTE_COMMAND_ID,
|
|
156
|
+
category,
|
|
157
|
+
title: ( localize2WithPath(
|
|
158
|
+
'vs/workbench/contrib/remote/browser/remoteIndicator',
|
|
159
|
+
'remote.close',
|
|
160
|
+
"Close Remote Connection"
|
|
161
|
+
)),
|
|
162
|
+
f1: true,
|
|
163
|
+
precondition: ( ContextKeyExpr.or(RemoteNameContext, VirtualWorkspaceContext))
|
|
164
|
+
});
|
|
165
|
+
this.run = () => that.hostService.openWindow({ forceReuseWindow: true, remoteAuthority: null });
|
|
166
|
+
}
|
|
167
|
+
}));
|
|
168
|
+
if (this.remoteAuthority) {
|
|
169
|
+
MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
|
|
170
|
+
group: '6_close',
|
|
171
|
+
command: {
|
|
172
|
+
id: RemoteStatusIndicator_1.CLOSE_REMOTE_COMMAND_ID,
|
|
173
|
+
title: ( localizeWithPath(
|
|
174
|
+
'vs/workbench/contrib/remote/browser/remoteIndicator',
|
|
175
|
+
{ key: 'miCloseRemote', comment: ['&& denotes a mnemonic'] },
|
|
176
|
+
"Close Re&&mote Connection"
|
|
177
|
+
))
|
|
178
|
+
},
|
|
179
|
+
order: 3.5
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if (this.extensionGalleryService.isEnabled()) {
|
|
184
|
+
this._register(registerAction2(class extends Action2 {
|
|
185
|
+
constructor() {
|
|
186
|
+
super({
|
|
187
|
+
id: RemoteStatusIndicator_1.INSTALL_REMOTE_EXTENSIONS_ID,
|
|
188
|
+
category,
|
|
189
|
+
title: ( localize2WithPath(
|
|
190
|
+
'vs/workbench/contrib/remote/browser/remoteIndicator',
|
|
191
|
+
'remote.install',
|
|
192
|
+
"Install Remote Development Extensions"
|
|
193
|
+
)),
|
|
194
|
+
f1: true
|
|
195
|
+
});
|
|
196
|
+
this.run = (accessor, input) => {
|
|
197
|
+
const paneCompositeService = accessor.get(IPaneCompositePartService);
|
|
198
|
+
return paneCompositeService.openPaneComposite(VIEWLET_ID, 0 , true).then(viewlet => {
|
|
199
|
+
if (viewlet) {
|
|
200
|
+
(viewlet?.getViewPaneContainer()).search(`@recommended:remotes`);
|
|
201
|
+
viewlet.focus();
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
}));
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
registerListeners() {
|
|
210
|
+
const updateRemoteActions = () => {
|
|
211
|
+
this.remoteMenuActionsGroups = undefined;
|
|
212
|
+
this.updateRemoteStatusIndicator();
|
|
213
|
+
};
|
|
214
|
+
this._register(this.legacyIndicatorMenu.onDidChange(updateRemoteActions));
|
|
215
|
+
this._register(this.remoteIndicatorMenu.onDidChange(updateRemoteActions));
|
|
216
|
+
this._register(this.labelService.onDidChangeFormatters(() => this.updateRemoteStatusIndicator()));
|
|
217
|
+
const remoteIndicator = this.environmentService.options?.windowIndicator;
|
|
218
|
+
if (remoteIndicator && remoteIndicator.onDidChange) {
|
|
219
|
+
this._register(remoteIndicator.onDidChange(() => this.updateRemoteStatusIndicator()));
|
|
220
|
+
}
|
|
221
|
+
if (this.remoteAuthority) {
|
|
222
|
+
const connection = this.remoteAgentService.getConnection();
|
|
223
|
+
if (connection) {
|
|
224
|
+
this._register(connection.onDidStateChange((e) => {
|
|
225
|
+
switch (e.type) {
|
|
226
|
+
case 0 :
|
|
227
|
+
case 2 :
|
|
228
|
+
case 1 :
|
|
229
|
+
this.setConnectionState('reconnecting');
|
|
230
|
+
break;
|
|
231
|
+
case 3 :
|
|
232
|
+
this.setConnectionState('disconnected');
|
|
233
|
+
break;
|
|
234
|
+
case 4 :
|
|
235
|
+
this.setConnectionState('connected');
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
}));
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
this._register(this.workspaceContextService.onDidChangeWorkbenchState(() => {
|
|
243
|
+
this.updateVirtualWorkspaceLocation();
|
|
244
|
+
this.updateRemoteStatusIndicator();
|
|
245
|
+
}));
|
|
246
|
+
}
|
|
247
|
+
if (isWeb) {
|
|
248
|
+
this._register(Event.any(this._register(( new DomEmitter(mainWindow, 'online'))).event, this._register(( new DomEmitter(mainWindow, 'offline'))).event)(() => this.setNetworkState(navigator.onLine ? 'online' : 'offline')));
|
|
249
|
+
}
|
|
250
|
+
this._register(this.extensionService.onDidChangeExtensions(async (result) => {
|
|
251
|
+
for (const ext of result.added) {
|
|
252
|
+
const index = this.remoteExtensionMetadata.findIndex(value => ExtensionIdentifier.equals(value.id, ext.identifier));
|
|
253
|
+
if (index > -1) {
|
|
254
|
+
this.remoteExtensionMetadata[index].installed = true;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}));
|
|
258
|
+
this._register(this.extensionManagementService.onDidUninstallExtension(async (result) => {
|
|
259
|
+
const index = this.remoteExtensionMetadata.findIndex(value => ExtensionIdentifier.equals(value.id, result.identifier.id));
|
|
260
|
+
if (index > -1) {
|
|
261
|
+
this.remoteExtensionMetadata[index].installed = false;
|
|
262
|
+
}
|
|
263
|
+
}));
|
|
264
|
+
}
|
|
265
|
+
async initializeRemoteMetadata() {
|
|
266
|
+
if (this.remoteMetadataInitialized) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
const currentPlatform = PlatformToString(platform);
|
|
270
|
+
for (let i = 0; i < this.remoteExtensionMetadata.length; i++) {
|
|
271
|
+
const extensionId = this.remoteExtensionMetadata[i].id;
|
|
272
|
+
const supportedPlatforms = this.remoteExtensionMetadata[i].supportedPlatforms;
|
|
273
|
+
const isInstalled = (await this.extensionManagementService.getInstalled()).find(value => ExtensionIdentifier.equals(value.identifier.id, extensionId)) ? true : false;
|
|
274
|
+
this.remoteExtensionMetadata[i].installed = isInstalled;
|
|
275
|
+
if (isInstalled) {
|
|
276
|
+
this.remoteExtensionMetadata[i].isPlatformCompatible = true;
|
|
277
|
+
}
|
|
278
|
+
else if (supportedPlatforms && !supportedPlatforms.includes(currentPlatform)) {
|
|
279
|
+
this.remoteExtensionMetadata[i].isPlatformCompatible = false;
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
this.remoteExtensionMetadata[i].isPlatformCompatible = true;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
this.remoteMetadataInitialized = true;
|
|
286
|
+
this._onDidChangeEntries.fire();
|
|
287
|
+
this.updateRemoteStatusIndicator();
|
|
288
|
+
}
|
|
289
|
+
updateVirtualWorkspaceLocation() {
|
|
290
|
+
this.virtualWorkspaceLocation = getVirtualWorkspaceLocation(this.workspaceContextService.getWorkspace());
|
|
291
|
+
}
|
|
292
|
+
async updateWhenInstalledExtensionsRegistered() {
|
|
293
|
+
await this.extensionService.whenInstalledExtensionsRegistered();
|
|
294
|
+
const remoteAuthority = this.remoteAuthority;
|
|
295
|
+
if (remoteAuthority) {
|
|
296
|
+
(async () => {
|
|
297
|
+
try {
|
|
298
|
+
const { authority } = await this.remoteAuthorityResolverService.resolveAuthority(remoteAuthority);
|
|
299
|
+
this.connectionToken = authority.connectionToken;
|
|
300
|
+
this.setConnectionState('connected');
|
|
301
|
+
}
|
|
302
|
+
catch (error) {
|
|
303
|
+
this.setConnectionState('disconnected');
|
|
304
|
+
}
|
|
305
|
+
})();
|
|
306
|
+
}
|
|
307
|
+
this.updateRemoteStatusIndicator();
|
|
308
|
+
this.initializeRemoteMetadata();
|
|
309
|
+
}
|
|
310
|
+
setConnectionState(newState) {
|
|
311
|
+
if (this.connectionState !== newState) {
|
|
312
|
+
this.connectionState = newState;
|
|
313
|
+
if (this.connectionState === 'reconnecting') {
|
|
314
|
+
this.connectionStateContextKey.set('disconnected');
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
this.connectionStateContextKey.set(this.connectionState);
|
|
318
|
+
}
|
|
319
|
+
this.updateRemoteStatusIndicator();
|
|
320
|
+
if (newState === 'connected') {
|
|
321
|
+
this.scheduleMeasureNetworkConnectionLatency();
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
scheduleMeasureNetworkConnectionLatency() {
|
|
326
|
+
if (!this.remoteAuthority ||
|
|
327
|
+
this.measureNetworkConnectionLatencyScheduler
|
|
328
|
+
) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
this.measureNetworkConnectionLatencyScheduler = this._register(( new RunOnceScheduler(
|
|
332
|
+
() => this.measureNetworkConnectionLatency(),
|
|
333
|
+
RemoteStatusIndicator_1.REMOTE_CONNECTION_LATENCY_SCHEDULER_DELAY
|
|
334
|
+
)));
|
|
335
|
+
this.measureNetworkConnectionLatencyScheduler.schedule(RemoteStatusIndicator_1.REMOTE_CONNECTION_LATENCY_SCHEDULER_FIRST_RUN_DELAY);
|
|
336
|
+
}
|
|
337
|
+
async measureNetworkConnectionLatency() {
|
|
338
|
+
if (this.hostService.hasFocus && this.networkState !== 'offline') {
|
|
339
|
+
const measurement = await remoteConnectionLatencyMeasurer.measure(this.remoteAgentService);
|
|
340
|
+
if (measurement) {
|
|
341
|
+
if (measurement.high) {
|
|
342
|
+
this.setNetworkState('high-latency');
|
|
343
|
+
}
|
|
344
|
+
else if (this.networkState === 'high-latency') {
|
|
345
|
+
this.setNetworkState('online');
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
this.measureNetworkConnectionLatencyScheduler?.schedule();
|
|
350
|
+
}
|
|
351
|
+
setNetworkState(newState) {
|
|
352
|
+
if (this.networkState !== newState) {
|
|
353
|
+
const oldState = this.networkState;
|
|
354
|
+
this.networkState = newState;
|
|
355
|
+
if (newState === 'high-latency') {
|
|
356
|
+
this.logService.warn(`Remote network connection appears to have high latency (${remoteConnectionLatencyMeasurer.latency?.current?.toFixed(2)}ms last, ${remoteConnectionLatencyMeasurer.latency?.average?.toFixed(2)}ms average)`);
|
|
357
|
+
}
|
|
358
|
+
if (this.connectionToken) {
|
|
359
|
+
if (newState === 'online' && oldState === 'high-latency') {
|
|
360
|
+
this.logNetworkConnectionHealthTelemetry(this.connectionToken, 'good');
|
|
361
|
+
}
|
|
362
|
+
else if (newState === 'high-latency' && oldState === 'online') {
|
|
363
|
+
this.logNetworkConnectionHealthTelemetry(this.connectionToken, 'poor');
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
this.updateRemoteStatusIndicator();
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
logNetworkConnectionHealthTelemetry(connectionToken, connectionHealth) {
|
|
370
|
+
this.telemetryService.publicLog2('remoteConnectionHealth', {
|
|
371
|
+
remoteName: getRemoteName(this.remoteAuthority),
|
|
372
|
+
reconnectionToken: connectionToken,
|
|
373
|
+
connectionHealth
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
validatedGroup(group) {
|
|
377
|
+
if (!group.match(/^(remote|virtualfs)_(\d\d)_(([a-z][a-z0-9+.-]*)_(.*))$/)) {
|
|
378
|
+
if (!this.loggedInvalidGroupNames[group]) {
|
|
379
|
+
this.loggedInvalidGroupNames[group] = true;
|
|
380
|
+
this.logService.warn(`Invalid group name used in "statusBar/remoteIndicator" menu contribution: ${group}. Entries ignored. Expected format: 'remote_$ORDER_$REMOTENAME_$GROUPING or 'virtualfs_$ORDER_$FILESCHEME_$GROUPING.`);
|
|
381
|
+
}
|
|
382
|
+
return false;
|
|
383
|
+
}
|
|
384
|
+
return true;
|
|
385
|
+
}
|
|
386
|
+
getRemoteMenuActions(doNotUseCache) {
|
|
387
|
+
if (!this.remoteMenuActionsGroups || doNotUseCache) {
|
|
388
|
+
this.remoteMenuActionsGroups = this.remoteIndicatorMenu.getActions().filter(a => this.validatedGroup(a[0])).concat(this.legacyIndicatorMenu.getActions());
|
|
389
|
+
}
|
|
390
|
+
return this.remoteMenuActionsGroups;
|
|
391
|
+
}
|
|
392
|
+
updateRemoteStatusIndicator() {
|
|
393
|
+
const remoteIndicator = this.environmentService.options?.windowIndicator;
|
|
394
|
+
if (remoteIndicator) {
|
|
395
|
+
let remoteIndicatorLabel = remoteIndicator.label.trim();
|
|
396
|
+
if (!remoteIndicatorLabel.startsWith('$(')) {
|
|
397
|
+
remoteIndicatorLabel = `$(remote) ${remoteIndicatorLabel}`;
|
|
398
|
+
}
|
|
399
|
+
this.renderRemoteStatusIndicator(truncate(remoteIndicatorLabel, RemoteStatusIndicator_1.REMOTE_STATUS_LABEL_MAX_LENGTH), remoteIndicator.tooltip, remoteIndicator.command);
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
if (this.remoteAuthority) {
|
|
403
|
+
const hostLabel = this.labelService.getHostLabel(Schemas.vscodeRemote, this.remoteAuthority) || this.remoteAuthority;
|
|
404
|
+
switch (this.connectionState) {
|
|
405
|
+
case 'initializing':
|
|
406
|
+
this.renderRemoteStatusIndicator(( localizeWithPath(
|
|
407
|
+
'vs/workbench/contrib/remote/browser/remoteIndicator',
|
|
408
|
+
'host.open',
|
|
409
|
+
"Opening Remote..."
|
|
410
|
+
)), ( localizeWithPath(
|
|
411
|
+
'vs/workbench/contrib/remote/browser/remoteIndicator',
|
|
412
|
+
'host.open',
|
|
413
|
+
"Opening Remote..."
|
|
414
|
+
)), undefined, true );
|
|
415
|
+
break;
|
|
416
|
+
case 'reconnecting':
|
|
417
|
+
this.renderRemoteStatusIndicator(`${( localizeWithPath(
|
|
418
|
+
'vs/workbench/contrib/remote/browser/remoteIndicator',
|
|
419
|
+
'host.reconnecting',
|
|
420
|
+
"Reconnecting to {0}...",
|
|
421
|
+
truncate(hostLabel, RemoteStatusIndicator_1.REMOTE_STATUS_LABEL_MAX_LENGTH)
|
|
422
|
+
))}`, undefined, undefined, true );
|
|
423
|
+
break;
|
|
424
|
+
case 'disconnected':
|
|
425
|
+
this.renderRemoteStatusIndicator(`$(alert) ${( localizeWithPath(
|
|
426
|
+
'vs/workbench/contrib/remote/browser/remoteIndicator',
|
|
427
|
+
'disconnectedFrom',
|
|
428
|
+
"Disconnected from {0}",
|
|
429
|
+
truncate(hostLabel, RemoteStatusIndicator_1.REMOTE_STATUS_LABEL_MAX_LENGTH)
|
|
430
|
+
))}`);
|
|
431
|
+
break;
|
|
432
|
+
default: {
|
|
433
|
+
const tooltip = ( new MarkdownString('', { isTrusted: true, supportThemeIcons: true }));
|
|
434
|
+
const hostNameTooltip = this.labelService.getHostTooltip(Schemas.vscodeRemote, this.remoteAuthority);
|
|
435
|
+
if (hostNameTooltip) {
|
|
436
|
+
tooltip.appendMarkdown(hostNameTooltip);
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
tooltip.appendText(( localizeWithPath(
|
|
440
|
+
'vs/workbench/contrib/remote/browser/remoteIndicator',
|
|
441
|
+
{ key: 'host.tooltip', comment: ['{0} is a remote host name, e.g. Dev Container'] },
|
|
442
|
+
"Editing on {0}",
|
|
443
|
+
hostLabel
|
|
444
|
+
)));
|
|
445
|
+
}
|
|
446
|
+
this.renderRemoteStatusIndicator(`$(remote) ${truncate(hostLabel, RemoteStatusIndicator_1.REMOTE_STATUS_LABEL_MAX_LENGTH)}`, tooltip);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
if (this.virtualWorkspaceLocation) {
|
|
452
|
+
const workspaceLabel = this.labelService.getHostLabel(this.virtualWorkspaceLocation.scheme, this.virtualWorkspaceLocation.authority);
|
|
453
|
+
if (workspaceLabel) {
|
|
454
|
+
const tooltip = ( new MarkdownString('', { isTrusted: true, supportThemeIcons: true }));
|
|
455
|
+
const hostNameTooltip = this.labelService.getHostTooltip(this.virtualWorkspaceLocation.scheme, this.virtualWorkspaceLocation.authority);
|
|
456
|
+
if (hostNameTooltip) {
|
|
457
|
+
tooltip.appendMarkdown(hostNameTooltip);
|
|
458
|
+
}
|
|
459
|
+
else {
|
|
460
|
+
tooltip.appendText(( localizeWithPath(
|
|
461
|
+
'vs/workbench/contrib/remote/browser/remoteIndicator',
|
|
462
|
+
{ key: 'workspace.tooltip', comment: ['{0} is a remote workspace name, e.g. GitHub'] },
|
|
463
|
+
"Editing on {0}",
|
|
464
|
+
workspaceLabel
|
|
465
|
+
)));
|
|
466
|
+
}
|
|
467
|
+
if (!isWeb || this.remoteAuthority) {
|
|
468
|
+
tooltip.appendMarkdown('\n\n');
|
|
469
|
+
tooltip.appendMarkdown(( localizeWithPath(
|
|
470
|
+
'vs/workbench/contrib/remote/browser/remoteIndicator',
|
|
471
|
+
{ key: 'workspace.tooltip2', comment: ['[features are not available]({1}) is a link. Only translate `features are not available`. Do not change brackets and parentheses or {0}'] },
|
|
472
|
+
"Some [features are not available]({0}) for resources located on a virtual file system.",
|
|
473
|
+
`command:${LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID}`
|
|
474
|
+
)));
|
|
475
|
+
}
|
|
476
|
+
this.renderRemoteStatusIndicator(`$(remote) ${truncate(workspaceLabel, RemoteStatusIndicator_1.REMOTE_STATUS_LABEL_MAX_LENGTH)}`, tooltip);
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
this.renderRemoteStatusIndicator(`$(remote)`, ( localizeWithPath(
|
|
481
|
+
'vs/workbench/contrib/remote/browser/remoteIndicator',
|
|
482
|
+
'noHost.tooltip',
|
|
483
|
+
"Open a Remote Window"
|
|
484
|
+
)));
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
renderRemoteStatusIndicator(initialText, initialTooltip, command, showProgress) {
|
|
488
|
+
const { text, tooltip, ariaLabel } = this.withNetworkStatus(initialText, initialTooltip, showProgress);
|
|
489
|
+
const properties = {
|
|
490
|
+
name: ( localizeWithPath(
|
|
491
|
+
'vs/workbench/contrib/remote/browser/remoteIndicator',
|
|
492
|
+
'remoteHost',
|
|
493
|
+
"Remote Host"
|
|
494
|
+
)),
|
|
495
|
+
kind: this.networkState === 'offline' ? 'offline' : 'remote',
|
|
496
|
+
ariaLabel,
|
|
497
|
+
text,
|
|
498
|
+
showProgress,
|
|
499
|
+
tooltip,
|
|
500
|
+
command: command ?? RemoteStatusIndicator_1.REMOTE_ACTIONS_COMMAND_ID
|
|
501
|
+
};
|
|
502
|
+
if (this.remoteStatusEntry) {
|
|
503
|
+
this.remoteStatusEntry.update(properties);
|
|
504
|
+
}
|
|
505
|
+
else {
|
|
506
|
+
this.remoteStatusEntry = this.statusbarService.addEntry(properties, 'status.host', 0 , Number.MAX_VALUE );
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
withNetworkStatus(initialText, initialTooltip, showProgress) {
|
|
510
|
+
let text = initialText;
|
|
511
|
+
let tooltip = initialTooltip;
|
|
512
|
+
let ariaLabel = getCodiconAriaLabel(text);
|
|
513
|
+
function textWithAlert() {
|
|
514
|
+
if (!showProgress && initialText.startsWith('$(remote)')) {
|
|
515
|
+
return initialText.replace('$(remote)', '$(alert)');
|
|
516
|
+
}
|
|
517
|
+
return initialText;
|
|
518
|
+
}
|
|
519
|
+
switch (this.networkState) {
|
|
520
|
+
case 'offline': {
|
|
521
|
+
const offlineMessage = ( localizeWithPath(
|
|
522
|
+
'vs/workbench/contrib/remote/browser/remoteIndicator',
|
|
523
|
+
'networkStatusOfflineTooltip',
|
|
524
|
+
"Network appears to be offline, certain features might be unavailable."
|
|
525
|
+
));
|
|
526
|
+
text = textWithAlert();
|
|
527
|
+
tooltip = this.appendTooltipLine(tooltip, offlineMessage);
|
|
528
|
+
ariaLabel = `${ariaLabel}, ${offlineMessage}`;
|
|
529
|
+
break;
|
|
530
|
+
}
|
|
531
|
+
case 'high-latency':
|
|
532
|
+
text = textWithAlert();
|
|
533
|
+
tooltip = this.appendTooltipLine(tooltip, ( localizeWithPath(
|
|
534
|
+
'vs/workbench/contrib/remote/browser/remoteIndicator',
|
|
535
|
+
'networkStatusHighLatencyTooltip',
|
|
536
|
+
"Network appears to have high latency ({0}ms last, {1}ms average), certain features may be slow to respond.",
|
|
537
|
+
remoteConnectionLatencyMeasurer.latency?.current?.toFixed(2),
|
|
538
|
+
remoteConnectionLatencyMeasurer.latency?.average?.toFixed(2)
|
|
539
|
+
)));
|
|
540
|
+
break;
|
|
541
|
+
}
|
|
542
|
+
return { text, tooltip, ariaLabel };
|
|
543
|
+
}
|
|
544
|
+
appendTooltipLine(tooltip, line) {
|
|
545
|
+
let markdownTooltip;
|
|
546
|
+
if (typeof tooltip === 'string') {
|
|
547
|
+
markdownTooltip = ( new MarkdownString(tooltip, { isTrusted: true, supportThemeIcons: true }));
|
|
548
|
+
}
|
|
549
|
+
else {
|
|
550
|
+
markdownTooltip = tooltip ?? ( new MarkdownString('', { isTrusted: true, supportThemeIcons: true }));
|
|
551
|
+
}
|
|
552
|
+
if (markdownTooltip.value.length > 0) {
|
|
553
|
+
markdownTooltip.appendMarkdown('\n\n');
|
|
554
|
+
}
|
|
555
|
+
markdownTooltip.appendMarkdown(line);
|
|
556
|
+
return markdownTooltip;
|
|
557
|
+
}
|
|
558
|
+
async installExtension(extensionId) {
|
|
559
|
+
const galleryExtension = (await this.extensionGalleryService.getExtensions([{ id: extensionId }], CancellationToken.None))[0];
|
|
560
|
+
await this.extensionManagementService.installFromGallery(galleryExtension, {
|
|
561
|
+
isMachineScoped: false,
|
|
562
|
+
donotIncludePackAndDependencies: false,
|
|
563
|
+
context: { [EXTENSION_INSTALL_SKIP_WALKTHROUGH_CONTEXT]: true }
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
async runRemoteStartCommand(extensionId, startCommand) {
|
|
567
|
+
await retry(async () => {
|
|
568
|
+
const ext = await this.extensionService.getExtension(extensionId);
|
|
569
|
+
if (!ext) {
|
|
570
|
+
throw Error('Failed to find installed remote extension');
|
|
571
|
+
}
|
|
572
|
+
return ext;
|
|
573
|
+
}, 300, 10);
|
|
574
|
+
this.commandService.executeCommand(startCommand);
|
|
575
|
+
this.telemetryService.publicLog2('workbenchActionExecuted', {
|
|
576
|
+
id: 'remoteInstallAndRun',
|
|
577
|
+
detail: extensionId,
|
|
578
|
+
from: 'remote indicator'
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
showRemoteMenu() {
|
|
582
|
+
const getCategoryLabel = (action) => {
|
|
583
|
+
if (action.item.category) {
|
|
584
|
+
return typeof action.item.category === 'string' ? action.item.category : action.item.category.value;
|
|
585
|
+
}
|
|
586
|
+
return undefined;
|
|
587
|
+
};
|
|
588
|
+
const matchCurrentRemote = () => {
|
|
589
|
+
if (this.remoteAuthority) {
|
|
590
|
+
return ( new RegExp(`^remote_\\d\\d_${getRemoteName(this.remoteAuthority)}_`));
|
|
591
|
+
}
|
|
592
|
+
else if (this.virtualWorkspaceLocation) {
|
|
593
|
+
return ( new RegExp(`^virtualfs_\\d\\d_${this.virtualWorkspaceLocation.scheme}_`));
|
|
594
|
+
}
|
|
595
|
+
return undefined;
|
|
596
|
+
};
|
|
597
|
+
const computeItems = () => {
|
|
598
|
+
let actionGroups = this.getRemoteMenuActions(true);
|
|
599
|
+
const items = [];
|
|
600
|
+
const currentRemoteMatcher = matchCurrentRemote();
|
|
601
|
+
if (currentRemoteMatcher) {
|
|
602
|
+
actionGroups = actionGroups.sort((g1, g2) => {
|
|
603
|
+
const isCurrentRemote1 = currentRemoteMatcher.test(g1[0]);
|
|
604
|
+
const isCurrentRemote2 = currentRemoteMatcher.test(g2[0]);
|
|
605
|
+
if (isCurrentRemote1 !== isCurrentRemote2) {
|
|
606
|
+
return isCurrentRemote1 ? -1 : 1;
|
|
607
|
+
}
|
|
608
|
+
if (g1[0] !== '' && g2[0] === '') {
|
|
609
|
+
return -1;
|
|
610
|
+
}
|
|
611
|
+
else if (g1[0] === '' && g2[0] !== '') {
|
|
612
|
+
return 1;
|
|
613
|
+
}
|
|
614
|
+
return g1[0].localeCompare(g2[0]);
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
let lastCategoryName = undefined;
|
|
618
|
+
for (const actionGroup of actionGroups) {
|
|
619
|
+
let hasGroupCategory = false;
|
|
620
|
+
for (const action of actionGroup[1]) {
|
|
621
|
+
if (action instanceof MenuItemAction) {
|
|
622
|
+
if (!hasGroupCategory) {
|
|
623
|
+
const category = getCategoryLabel(action);
|
|
624
|
+
if (category !== lastCategoryName) {
|
|
625
|
+
items.push({ type: 'separator', label: category });
|
|
626
|
+
lastCategoryName = category;
|
|
627
|
+
}
|
|
628
|
+
hasGroupCategory = true;
|
|
629
|
+
}
|
|
630
|
+
const label = typeof action.item.title === 'string' ? action.item.title : action.item.title.value;
|
|
631
|
+
items.push({
|
|
632
|
+
type: 'item',
|
|
633
|
+
id: action.item.id,
|
|
634
|
+
label
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
const showExtensionRecommendations = this.configurationService.getValue('workbench.remoteIndicator.showExtensionRecommendations');
|
|
640
|
+
if (showExtensionRecommendations && this.extensionGalleryService.isEnabled() && this.remoteMetadataInitialized) {
|
|
641
|
+
const notInstalledItems = [];
|
|
642
|
+
for (const metadata of this.remoteExtensionMetadata) {
|
|
643
|
+
if (!metadata.installed && metadata.isPlatformCompatible) {
|
|
644
|
+
const label = metadata.startConnectLabel;
|
|
645
|
+
const buttons = [{
|
|
646
|
+
iconClass: ThemeIcon.asClassName(infoIcon),
|
|
647
|
+
tooltip: ( localizeWithPath(
|
|
648
|
+
'vs/workbench/contrib/remote/browser/remoteIndicator',
|
|
649
|
+
'remote.startActions.help',
|
|
650
|
+
"Learn More"
|
|
651
|
+
))
|
|
652
|
+
}];
|
|
653
|
+
notInstalledItems.push({ type: 'item', id: metadata.id, label: label, buttons: buttons });
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
items.push({
|
|
657
|
+
type: 'separator', label: ( localizeWithPath(
|
|
658
|
+
'vs/workbench/contrib/remote/browser/remoteIndicator',
|
|
659
|
+
'remote.startActions.install',
|
|
660
|
+
'Install'
|
|
661
|
+
))
|
|
662
|
+
});
|
|
663
|
+
items.push(...notInstalledItems);
|
|
664
|
+
}
|
|
665
|
+
items.push({
|
|
666
|
+
type: 'separator'
|
|
667
|
+
});
|
|
668
|
+
const entriesBeforeConfig = items.length;
|
|
669
|
+
if (RemoteStatusIndicator_1.SHOW_CLOSE_REMOTE_COMMAND_ID) {
|
|
670
|
+
if (this.remoteAuthority) {
|
|
671
|
+
items.push({
|
|
672
|
+
type: 'item',
|
|
673
|
+
id: RemoteStatusIndicator_1.CLOSE_REMOTE_COMMAND_ID,
|
|
674
|
+
label: ( localizeWithPath(
|
|
675
|
+
'vs/workbench/contrib/remote/browser/remoteIndicator',
|
|
676
|
+
'closeRemoteConnection.title',
|
|
677
|
+
'Close Remote Connection'
|
|
678
|
+
))
|
|
679
|
+
});
|
|
680
|
+
if (this.connectionState === 'disconnected') {
|
|
681
|
+
items.push({
|
|
682
|
+
type: 'item',
|
|
683
|
+
id: ReloadWindowAction.ID,
|
|
684
|
+
label: ( localizeWithPath(
|
|
685
|
+
'vs/workbench/contrib/remote/browser/remoteIndicator',
|
|
686
|
+
'reloadWindow',
|
|
687
|
+
'Reload Window'
|
|
688
|
+
))
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
else if (this.virtualWorkspaceLocation) {
|
|
693
|
+
items.push({
|
|
694
|
+
type: 'item',
|
|
695
|
+
id: RemoteStatusIndicator_1.CLOSE_REMOTE_COMMAND_ID,
|
|
696
|
+
label: ( localizeWithPath(
|
|
697
|
+
'vs/workbench/contrib/remote/browser/remoteIndicator',
|
|
698
|
+
'closeVirtualWorkspace.title',
|
|
699
|
+
'Close Remote Workspace'
|
|
700
|
+
))
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
if (items.length === entriesBeforeConfig) {
|
|
705
|
+
items.pop();
|
|
706
|
+
}
|
|
707
|
+
return items;
|
|
708
|
+
};
|
|
709
|
+
const quickPick = this.quickInputService.createQuickPick();
|
|
710
|
+
quickPick.placeholder = ( localizeWithPath(
|
|
711
|
+
'vs/workbench/contrib/remote/browser/remoteIndicator',
|
|
712
|
+
'remoteActions',
|
|
713
|
+
"Select an option to open a Remote Window"
|
|
714
|
+
));
|
|
715
|
+
quickPick.items = computeItems();
|
|
716
|
+
quickPick.sortByLabel = false;
|
|
717
|
+
quickPick.canSelectMany = false;
|
|
718
|
+
Event.once(quickPick.onDidAccept)((async (_) => {
|
|
719
|
+
const selectedItems = quickPick.selectedItems;
|
|
720
|
+
if (selectedItems.length === 1) {
|
|
721
|
+
const commandId = selectedItems[0].id;
|
|
722
|
+
const remoteExtension = this.remoteExtensionMetadata.find(value => ExtensionIdentifier.equals(value.id, commandId));
|
|
723
|
+
if (remoteExtension) {
|
|
724
|
+
quickPick.items = [];
|
|
725
|
+
quickPick.busy = true;
|
|
726
|
+
quickPick.placeholder = ( localizeWithPath(
|
|
727
|
+
'vs/workbench/contrib/remote/browser/remoteIndicator',
|
|
728
|
+
'remote.startActions.installingExtension',
|
|
729
|
+
'Installing extension... '
|
|
730
|
+
));
|
|
731
|
+
await this.installExtension(remoteExtension.id);
|
|
732
|
+
quickPick.hide();
|
|
733
|
+
await this.runRemoteStartCommand(remoteExtension.id, remoteExtension.startCommand);
|
|
734
|
+
}
|
|
735
|
+
else {
|
|
736
|
+
this.telemetryService.publicLog2('workbenchActionExecuted', {
|
|
737
|
+
id: commandId,
|
|
738
|
+
from: 'remote indicator'
|
|
739
|
+
});
|
|
740
|
+
this.commandService.executeCommand(commandId);
|
|
741
|
+
quickPick.hide();
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
}));
|
|
745
|
+
Event.once(quickPick.onDidTriggerItemButton)(async (e) => {
|
|
746
|
+
const remoteExtension = this.remoteExtensionMetadata.find(value => ExtensionIdentifier.equals(value.id, e.item.id));
|
|
747
|
+
if (remoteExtension) {
|
|
748
|
+
await this.openerService.open(( URI.parse(remoteExtension.helpLink)));
|
|
749
|
+
}
|
|
750
|
+
});
|
|
751
|
+
const legacyItemUpdater = this.legacyIndicatorMenu.onDidChange(() => quickPick.items = computeItems());
|
|
752
|
+
quickPick.onDidHide(legacyItemUpdater.dispose);
|
|
753
|
+
const itemUpdater = this.remoteIndicatorMenu.onDidChange(() => quickPick.items = computeItems());
|
|
754
|
+
quickPick.onDidHide(itemUpdater.dispose);
|
|
755
|
+
if (!this.remoteMetadataInitialized) {
|
|
756
|
+
quickPick.busy = true;
|
|
757
|
+
this._register(this.onDidChangeEntries(() => {
|
|
758
|
+
quickPick.busy = false;
|
|
759
|
+
quickPick.items = computeItems();
|
|
760
|
+
}));
|
|
761
|
+
}
|
|
762
|
+
quickPick.show();
|
|
763
|
+
}
|
|
764
|
+
};
|
|
765
|
+
RemoteStatusIndicator = RemoteStatusIndicator_1 = ( __decorate([
|
|
766
|
+
( __param(0, IStatusbarService)),
|
|
767
|
+
( __param(1, IBrowserWorkbenchEnvironmentService)),
|
|
768
|
+
( __param(2, ILabelService)),
|
|
769
|
+
( __param(3, IContextKeyService)),
|
|
770
|
+
( __param(4, IMenuService)),
|
|
771
|
+
( __param(5, IQuickInputService)),
|
|
772
|
+
( __param(6, ICommandService)),
|
|
773
|
+
( __param(7, IExtensionService)),
|
|
774
|
+
( __param(8, IRemoteAgentService)),
|
|
775
|
+
( __param(9, IRemoteAuthorityResolverService)),
|
|
776
|
+
( __param(10, IHostService)),
|
|
777
|
+
( __param(11, IWorkspaceContextService)),
|
|
778
|
+
( __param(12, ILogService)),
|
|
779
|
+
( __param(13, IExtensionGalleryService)),
|
|
780
|
+
( __param(14, ITelemetryService)),
|
|
781
|
+
( __param(15, IProductService)),
|
|
782
|
+
( __param(16, IExtensionManagementService)),
|
|
783
|
+
( __param(17, IOpenerService)),
|
|
784
|
+
( __param(18, IConfigurationService))
|
|
785
|
+
], RemoteStatusIndicator));
|
|
786
|
+
( Registry.as(Extensions.Configuration))
|
|
787
|
+
.registerConfiguration({
|
|
788
|
+
...workbenchConfigurationNodeBase,
|
|
789
|
+
properties: {
|
|
790
|
+
'workbench.remoteIndicator.showExtensionRecommendations': {
|
|
791
|
+
type: 'boolean',
|
|
792
|
+
markdownDescription: ( localizeWithPath(
|
|
793
|
+
'vs/workbench/contrib/remote/browser/remoteIndicator',
|
|
794
|
+
'remote.showExtensionRecommendations',
|
|
795
|
+
"When enabled, remote extensions recommendations will be shown in the Remote Indicator menu."
|
|
796
|
+
)),
|
|
797
|
+
default: true
|
|
798
|
+
},
|
|
799
|
+
}
|
|
800
|
+
});
|
|
801
|
+
|
|
802
|
+
export { RemoteStatusIndicator };
|