-
Notifications
You must be signed in to change notification settings - Fork 5.9k
/
Copy pathchannel.ts
556 lines (489 loc) · 22.6 KB
/
channel.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
import { field, logger } from '@coder/logger';
import * as os from 'os';
import * as path from 'path';
import { VSBuffer } from 'vs/base/common/buffer';
import { CancellationTokenSource } from 'vs/base/common/cancellation';
import { Emitter, Event } from 'vs/base/common/event';
import { IDisposable } from 'vs/base/common/lifecycle';
import * as platform from 'vs/base/common/platform';
import * as resources from 'vs/base/common/resources';
import { ReadableStreamEventPayload } from 'vs/base/common/stream';
import { URI, UriComponents } from 'vs/base/common/uri';
import { transformOutgoingURIs } from 'vs/base/common/uriIpc';
import { IServerChannel } from 'vs/base/parts/ipc/common/ipc';
import { IDiagnosticInfo } from 'vs/platform/diagnostics/common/diagnostics';
import { INativeEnvironmentService } from 'vs/platform/environment/common/environment';
import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import { FileDeleteOptions, FileOpenOptions, FileOverwriteOptions, FileReadStreamOptions, FileType, FileWriteOptions, IStat, IWatchOptions } from 'vs/platform/files/common/files';
import { DiskFileSystemProvider } from 'vs/platform/files/node/diskFileSystemProvider';
import { ILogService } from 'vs/platform/log/common/log';
import product from 'vs/platform/product/common/product';
import { IRemoteAgentEnvironment, RemoteAgentConnectionContext } from 'vs/platform/remote/common/remoteAgentEnvironment';
import { ITelemetryData, ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IPtyService, IShellLaunchConfig, ITerminalEnvironment } from 'vs/platform/terminal/common/terminal';
import { getTranslations } from 'vs/server/node/nls';
import { getUriTransformer } from 'vs/server/node/util';
import { IFileChangeDto } from 'vs/workbench/api/common/extHost.protocol';
import { IEnvironmentVariableCollection } from 'vs/workbench/contrib/terminal/common/environmentVariable';
import { MergedEnvironmentVariableCollection } from 'vs/workbench/contrib/terminal/common/environmentVariableCollection';
import { deserializeEnvironmentVariableCollection } from 'vs/workbench/contrib/terminal/common/environmentVariableShared';
import * as terminal from 'vs/workbench/contrib/terminal/common/remoteTerminalChannel';
import * as terminalEnvironment from 'vs/workbench/contrib/terminal/common/terminalEnvironment';
import { AbstractVariableResolverService } from 'vs/workbench/services/configurationResolver/common/variableResolver';
import { ExtensionScanner, ExtensionScannerInput } from 'vs/workbench/services/extensions/node/extensionPoints';
/**
* Extend the file provider to allow unwatching.
*/
class Watcher extends DiskFileSystemProvider {
public readonly watches = new Map<number, IDisposable>();
public override dispose(): void {
this.watches.forEach((w) => w.dispose());
this.watches.clear();
super.dispose();
}
public _watch(req: number, resource: URI, opts: IWatchOptions): void {
this.watches.set(req, this.watch(resource, opts));
}
public unwatch(req: number): void {
this.watches.get(req)!.dispose();
this.watches.delete(req);
}
}
export class FileProviderChannel implements IServerChannel<RemoteAgentConnectionContext>, IDisposable {
private readonly provider: DiskFileSystemProvider;
private readonly watchers = new Map<string, Watcher>();
public constructor(
private readonly environmentService: INativeEnvironmentService,
private readonly logService: ILogService,
) {
this.provider = new DiskFileSystemProvider(this.logService);
}
public listen(context: RemoteAgentConnectionContext, event: string, args?: any): Event<any> {
switch (event) {
case 'filechange': return this.filechange(context, args[0]);
case 'readFileStream': return this.readFileStream(args[0], args[1]);
}
throw new Error(`Invalid listen '${event}'`);
}
private filechange(context: RemoteAgentConnectionContext, session: string): Event<IFileChangeDto[]> {
const emitter = new Emitter<IFileChangeDto[]>({
onFirstListenerAdd: () => {
const provider = new Watcher(this.logService);
this.watchers.set(session, provider);
const transformer = getUriTransformer(context.remoteAuthority);
provider.onDidChangeFile((events) => {
emitter.fire(events.map((event) => ({
...event,
resource: transformer.transformOutgoing(event.resource),
})));
});
provider.onDidErrorOccur((event) => this.logService.error(event));
},
onLastListenerRemove: () => {
this.watchers.get(session)!.dispose();
this.watchers.delete(session);
},
});
return emitter.event;
}
private readFileStream(resource: UriComponents, opts: FileReadStreamOptions): Event<ReadableStreamEventPayload<VSBuffer>> {
const cts = new CancellationTokenSource();
const fileStream = this.provider.readFileStream(this.transform(resource), opts, cts.token);
const emitter = new Emitter<ReadableStreamEventPayload<VSBuffer>>({
onFirstListenerAdd: () => {
fileStream.on('data', (data) => emitter.fire(VSBuffer.wrap(data)));
fileStream.on('error', (error) => emitter.fire(error));
fileStream.on('end', () => emitter.fire('end'));
},
onLastListenerRemove: () => cts.cancel(),
});
return emitter.event;
}
public call(_: unknown, command: string, args?: any): Promise<any> {
switch (command) {
case 'stat': return this.stat(args[0]);
case 'open': return this.open(args[0], args[1]);
case 'close': return this.close(args[0]);
case 'read': return this.read(args[0], args[1], args[2]);
case 'readFile': return this.readFile(args[0]);
case 'write': return this.write(args[0], args[1], args[2], args[3], args[4]);
case 'writeFile': return this.writeFile(args[0], args[1], args[2]);
case 'delete': return this.delete(args[0], args[1]);
case 'mkdir': return this.mkdir(args[0]);
case 'readdir': return this.readdir(args[0]);
case 'rename': return this.rename(args[0], args[1], args[2]);
case 'copy': return this.copy(args[0], args[1], args[2]);
case 'watch': return this.watch(args[0], args[1], args[2], args[3]);
case 'unwatch': return this.unwatch(args[0], args[1]);
}
throw new Error(`Invalid call '${command}'`);
}
public dispose(): void {
this.watchers.forEach((w) => w.dispose());
this.watchers.clear();
}
private async stat(resource: UriComponents): Promise<IStat> {
return this.provider.stat(this.transform(resource));
}
private async open(resource: UriComponents, opts: FileOpenOptions): Promise<number> {
return this.provider.open(this.transform(resource), opts);
}
private async close(fd: number): Promise<void> {
return this.provider.close(fd);
}
private async read(fd: number, pos: number, length: number): Promise<[VSBuffer, number]> {
const buffer = VSBuffer.alloc(length);
const bytesRead = await this.provider.read(fd, pos, buffer.buffer, 0, length);
return [buffer, bytesRead];
}
private async readFile(resource: UriComponents): Promise<VSBuffer> {
return VSBuffer.wrap(await this.provider.readFile(this.transform(resource)));
}
private write(fd: number, pos: number, buffer: VSBuffer, offset: number, length: number): Promise<number> {
return this.provider.write(fd, pos, buffer.buffer, offset, length);
}
private writeFile(resource: UriComponents, buffer: VSBuffer, opts: FileWriteOptions): Promise<void> {
return this.provider.writeFile(this.transform(resource), buffer.buffer, opts);
}
private async delete(resource: UriComponents, opts: FileDeleteOptions): Promise<void> {
return this.provider.delete(this.transform(resource), opts);
}
private async mkdir(resource: UriComponents): Promise<void> {
return this.provider.mkdir(this.transform(resource));
}
private async readdir(resource: UriComponents): Promise<[string, FileType][]> {
return this.provider.readdir(this.transform(resource));
}
private async rename(resource: UriComponents, target: UriComponents, opts: FileOverwriteOptions): Promise<void> {
return this.provider.rename(this.transform(resource), URI.from(target), opts);
}
private copy(resource: UriComponents, target: UriComponents, opts: FileOverwriteOptions): Promise<void> {
return this.provider.copy(this.transform(resource), URI.from(target), opts);
}
private async watch(session: string, req: number, resource: UriComponents, opts: IWatchOptions): Promise<void> {
this.watchers.get(session)!._watch(req, this.transform(resource), opts);
}
private async unwatch(session: string, req: number): Promise<void> {
this.watchers.get(session)!.unwatch(req);
}
private transform(resource: UriComponents): URI {
// Used for walkthrough content.
if (/^\/static[^/]*\//.test(resource.path)) {
return URI.file(this.environmentService.appRoot + resource.path.replace(/^\/static[^/]*\//, '/'));
// Used by the webview service worker to load resources.
} else if (resource.path === '/vscode-resource' && resource.query) {
try {
const query = JSON.parse(resource.query);
if (query.requestResourcePath) {
return URI.file(query.requestResourcePath);
}
} catch (error) { /* Carry on. */ }
}
return URI.from(resource);
}
}
// See ../../workbench/services/remote/common/remoteAgentEnvironmentChannel.ts
export class ExtensionEnvironmentChannel implements IServerChannel {
public constructor(
private readonly environment: INativeEnvironmentService,
private readonly log: ILogService,
private readonly telemetry: ITelemetryService,
private readonly connectionToken: string,
) {}
public listen(_: unknown, event: string): Event<any> {
throw new Error(`Invalid listen '${event}'`);
}
public async call(context: any, command: string, args: any): Promise<any> {
switch (command) {
case 'getEnvironmentData':
return transformOutgoingURIs(
await this.getEnvironmentData(),
getUriTransformer(context.remoteAuthority),
);
case 'scanExtensions':
return transformOutgoingURIs(
await this.scanExtensions(args.language),
getUriTransformer(context.remoteAuthority),
);
case 'getDiagnosticInfo': return this.getDiagnosticInfo();
case 'disableTelemetry': return this.disableTelemetry();
case 'logTelemetry': return this.logTelemetry(args[0], args[1]);
case 'flushTelemetry': return this.flushTelemetry();
}
throw new Error(`Invalid call '${command}'`);
}
private async getEnvironmentData(): Promise<IRemoteAgentEnvironment> {
return {
pid: process.pid,
connectionToken: this.connectionToken,
appRoot: URI.file(this.environment.appRoot),
settingsPath: this.environment.settingsResource,
logsPath: URI.file(this.environment.logsPath),
extensionsPath: URI.file(this.environment.extensionsPath!),
extensionHostLogsPath: URI.file(path.join(this.environment.logsPath, 'extension-host')),
globalStorageHome: this.environment.globalStorageHome,
workspaceStorageHome: this.environment.workspaceStorageHome,
userHome: this.environment.userHome,
useHostProxy: false,
os: platform.OS,
marks: []
};
}
private async scanExtensions(language: string): Promise<IExtensionDescription[]> {
const translations = await getTranslations(language, this.environment.userDataPath);
const scanMultiple = (isBuiltin: boolean, isUnderDevelopment: boolean, paths: string[]): Promise<IExtensionDescription[][]> => {
return Promise.all(paths.map((path) => {
return ExtensionScanner.scanExtensions(new ExtensionScannerInput(
product.version,
product.date,
product.commit,
language,
!!process.env.VSCODE_DEV,
path,
isBuiltin,
isUnderDevelopment,
translations,
), this.log);
}));
};
const scanBuiltin = async (): Promise<IExtensionDescription[][]> => {
return scanMultiple(true, false, [this.environment.builtinExtensionsPath, ...this.environment.extraBuiltinExtensionPaths]);
};
const scanInstalled = async (): Promise<IExtensionDescription[][]> => {
return scanMultiple(false, true, [this.environment.extensionsPath!, ...this.environment.extraExtensionPaths]);
};
return Promise.all([scanBuiltin(), scanInstalled()]).then((allExtensions) => {
const uniqueExtensions = new Map<string, IExtensionDescription>();
allExtensions.forEach((multipleExtensions) => {
multipleExtensions.forEach((extensions) => {
extensions.forEach((extension) => {
const id = ExtensionIdentifier.toKey(extension.identifier);
if (uniqueExtensions.has(id)) {
const oldPath = uniqueExtensions.get(id)!.extensionLocation.fsPath;
const newPath = extension.extensionLocation.fsPath;
this.log.warn(`${oldPath} has been overridden ${newPath}`);
}
uniqueExtensions.set(id, extension);
});
});
});
return Array.from(uniqueExtensions.values());
});
}
private getDiagnosticInfo(): Promise<IDiagnosticInfo> {
throw new Error('not implemented');
}
private async disableTelemetry(): Promise<void> {
this.telemetry.setEnabled(false);
}
private async logTelemetry(eventName: string, data: ITelemetryData): Promise<void> {
this.telemetry.publicLog(eventName, data);
}
private async flushTelemetry(): Promise<void> {
// We always send immediately at the moment.
}
}
// Reference: - ../../workbench/api/common/extHostDebugService.ts
class VariableResolverService extends AbstractVariableResolverService {
constructor(
remoteAuthority: string,
args: terminal.ICreateTerminalProcessArguments,
env: platform.IProcessEnvironment,
) {
super({
getFolderUri: (name: string): URI | undefined => {
const folder = args.workspaceFolders.find((f) => f.name === name);
return folder && URI.revive(folder.uri);
},
getWorkspaceFolderCount: (): number => {
return args.workspaceFolders.length;
},
// In ../../workbench/contrib/terminal/common/remoteTerminalChannel.ts it
// looks like there are `config:` entries which must be for this? Not sure
// how/if the URI comes into play though.
getConfigurationValue: (_: URI, section: string): string | undefined => {
return args.resolvedVariables[`config:${section}`];
},
getAppRoot: (): string | undefined => {
return (args.resolverEnv && args.resolverEnv['VSCODE_CWD']) || env['VSCODE_CWD'] || process.cwd();
},
getExecPath: (): string | undefined => {
// Assuming that resolverEnv is just for use in the resolver and not for
// the terminal itself.
return (args.resolverEnv && args.resolverEnv['VSCODE_EXEC_PATH']) || env['VSCODE_EXEC_PATH'];
},
// This is just a guess; this is the only file-related thing we're sent
// and none of these resolver methods seem to get called so I don't know
// how to test.
getFilePath: (): string | undefined => {
const resource = transformIncoming(remoteAuthority, args.activeFileResource);
if (!resource) {
return undefined;
}
// See ../../editor/standalone/browser/simpleServices.ts;
// `BaseConfigurationResolverService` calls `getUriLabel` from there.
if (resource.scheme === 'file') {
return resource.fsPath;
}
return resource.path;
},
// It looks like these are set here although they aren't on the types:
// ../../workbench/contrib/terminal/common/remoteTerminalChannel.ts
getSelectedText: (): string | undefined => {
return args.resolvedVariables.selectedText;
},
getLineNumber: (): string | undefined => {
return args.resolvedVariables.selectedText;
},
}, undefined, Promise.resolve(env));
}
}
export class TerminalProviderChannel implements IServerChannel<RemoteAgentConnectionContext>, IDisposable {
public constructor (
private readonly logService: ILogService,
private readonly ptyService: IPtyService,
) {}
public listen(_: RemoteAgentConnectionContext, event: string, args: any): Event<any> {
logger.trace('TerminalProviderChannel:listen', field('event', event), field('args', args));
switch (event) {
case '$onPtyHostExitEvent': return this.ptyService.onPtyHostExit || Event.None;
case '$onPtyHostStartEvent': return this.ptyService.onPtyHostStart || Event.None;
case '$onPtyHostUnresponsiveEvent': return this.ptyService.onPtyHostUnresponsive || Event.None;
case '$onPtyHostResponsiveEvent': return this.ptyService.onPtyHostResponsive || Event.None;
case '$onProcessDataEvent': return this.ptyService.onProcessData;
case '$onProcessExitEvent': return this.ptyService.onProcessExit;
case '$onProcessReadyEvent': return this.ptyService.onProcessReady;
case '$onProcessReplayEvent': return this.ptyService.onProcessReplay;
case '$onProcessTitleChangedEvent': return this.ptyService.onProcessTitleChanged;
case '$onProcessShellTypeChangedEvent': return this.ptyService.onProcessShellTypeChanged;
case '$onProcessOverrideDimensionsEvent': return this.ptyService.onProcessOverrideDimensions;
case '$onProcessResolvedShellLaunchConfigEvent': return this.ptyService.onProcessResolvedShellLaunchConfig;
case '$onProcessOrphanQuestion': return this.ptyService.onProcessOrphanQuestion;
// NOTE@asher: I think this must have something to do with running
// commands on the terminal that will do things in VS Code but we
// already have that functionality via a socket so I'm not sure what
// this is for.
case '$onExecuteCommand': return Event.None;
}
throw new Error(`Invalid listen '${event}'`);
}
public call(context: RemoteAgentConnectionContext, command: string, args: any): Promise<any> {
logger.trace('TerminalProviderChannel:call', field('command', command), field('args', args));
switch (command) {
case '$restartPtyHost': return this.restartPtyHost();
case '$createProcess': return this.createProcess(context.remoteAuthority, args);
case '$attachToProcess': return this.ptyService.attachToProcess(args[0]);
case '$start': return this.ptyService.start(args[0]);
case '$input': return this.ptyService.input(args[0], args[1]);
case '$acknowledgeDataEvent': return this.ptyService.acknowledgeDataEvent(args[0], args[1]);
case '$shutdown': return this.ptyService.shutdown(args[0], args[1]);
case '$resize': return this.ptyService.resize(args[0], args[1], args[2]);
case '$getInitialCwd': return this.ptyService.getInitialCwd(args[0]);
case '$getCwd': return this.ptyService.getCwd(args[0]);
case '$sendCommandResult': return this.sendCommandResult(args[0], args[1], args[2], args[3]);
case '$orphanQuestionReply': return this.ptyService.orphanQuestionReply(args[0]);
case '$listProcesses': return this.ptyService.listProcesses();
case '$setTerminalLayoutInfo': return this.ptyService.setTerminalLayoutInfo(args);
case '$getTerminalLayoutInfo': return this.ptyService.getTerminalLayoutInfo(args);
case '$getEnvironment': return this.ptyService.getEnvironment();
case '$getDefaultSystemShell': return this.ptyService.getDefaultSystemShell(args[0]);
case '$reduceConnectionGraceTime': return this.ptyService.reduceConnectionGraceTime();
}
throw new Error(`Invalid call '${command}'`);
}
public async dispose(): Promise<void> {
// Nothing at the moment.
}
private async restartPtyHost(): Promise<void> {
if (this.ptyService.restartPtyHost) {
return this.ptyService.restartPtyHost();
}
}
// References: - ../../workbench/api/node/extHostTerminalService.ts
// - ../../workbench/contrib/terminal/browser/terminalProcessManager.ts
private async createProcess(remoteAuthority: string, args: terminal.ICreateTerminalProcessArguments): Promise<terminal.ICreateTerminalProcessResult> {
const shellLaunchConfig: IShellLaunchConfig = {
name: args.shellLaunchConfig.name,
executable: args.shellLaunchConfig.executable,
args: args.shellLaunchConfig.args,
// TODO: Should we transform if it's a string as well? The incoming
// transform only takes `UriComponents` so I suspect it's not necessary.
cwd: typeof args.shellLaunchConfig.cwd !== 'string'
? transformIncoming(remoteAuthority, args.shellLaunchConfig.cwd)
: args.shellLaunchConfig.cwd,
env: args.shellLaunchConfig.env,
};
const activeWorkspaceUri = transformIncoming(remoteAuthority, args.activeWorkspaceFolder?.uri);
const activeWorkspace = activeWorkspaceUri && args.activeWorkspaceFolder ? {
...args.activeWorkspaceFolder,
uri: activeWorkspaceUri,
toResource: (relativePath: string) => resources.joinPath(activeWorkspaceUri, relativePath),
} : undefined;
const resolverService = new VariableResolverService(remoteAuthority, args, process.env);
const resolver = terminalEnvironment.createVariableResolver(activeWorkspace, process.env, resolverService);
shellLaunchConfig.cwd = terminalEnvironment.getCwd(
shellLaunchConfig,
os.homedir(),
resolver,
activeWorkspaceUri,
args.configuration['terminal.integrated.cwd'],
this.logService,
);
// Use instead of `terminal.integrated.env.${platform}` to make types work.
const getEnvFromConfig = (): ITerminalEnvironment => {
if (platform.isWindows) {
return args.configuration['terminal.integrated.env.windows'];
} else if (platform.isMacintosh) {
return args.configuration['terminal.integrated.env.osx'];
}
return args.configuration['terminal.integrated.env.linux'];
};
const getEnvironment = async (): Promise<platform.IProcessEnvironment> => {
const env = await this.ptyService.getEnvironment();
env.VSCODE_IPC_HOOK_CLI = process.env['VSCODE_IPC_HOOK_CLI']!;
return env;
};
const env = terminalEnvironment.createTerminalEnvironment(
shellLaunchConfig,
getEnvFromConfig(),
resolver,
product.version,
args.configuration['terminal.integrated.detectLocale'],
await getEnvironment()
);
// Apply extension environment variable collections to the environment.
if (!shellLaunchConfig.strictEnv) {
// They come in an array and in serialized format.
const envVariableCollections = new Map<string, IEnvironmentVariableCollection>();
for (const [k, v] of args.envVariableCollections) {
envVariableCollections.set(k, { map: deserializeEnvironmentVariableCollection(v) });
}
const mergedCollection = new MergedEnvironmentVariableCollection(envVariableCollections);
mergedCollection.applyToProcessEnvironment(env);
}
const persistentTerminalId = await this.ptyService.createProcess(
shellLaunchConfig,
shellLaunchConfig.cwd,
args.cols,
args.rows,
env,
process.env as platform.IProcessEnvironment, // Environment used for findExecutable
false, // windowsEnableConpty
args.shouldPersistTerminal,
args.workspaceId,
args.workspaceName,
);
return {
persistentTerminalId,
resolvedShellLaunchConfig: shellLaunchConfig,
};
}
private async sendCommandResult(_id: number, _reqId: number, _isError: boolean, _payload: any): Promise<void> {
// NOTE: Not required unless we implement the matching event, see above.
throw new Error('not implemented');
}
}
function transformIncoming(remoteAuthority: string, uri: UriComponents | undefined): URI | undefined {
const transformer = getUriTransformer(remoteAuthority);
return uri ? URI.revive(transformer.transformIncoming(uri)) : uri;
}