Skip to content

Commit 068e399

Browse files
committed
Remove Node browser shim
We used this to run vscodevim in the browser but it now has a version that is able to run as a VS Code web extension. This does require an update to our marketplace, however.
1 parent a652318 commit 068e399

20 files changed

+6
-359
lines changed

docs/CONTRIBUTING.md

-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ Some noteworthy changes in our version of VS Code:
144144
- Sending client-side telemetry through the server
145145
- Allowing modification of the display language
146146
- Making it possible for us to load code on the client
147-
- Making extensions work in the browser
148147
- Making it possible to install extensions of any kind
149148
- Fixing issue with getting disconnected when your machine sleeps or hibernates
150149
- Adding connection type to web socket query parameters

lib/vscode/package.json

-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@
5050
"dependencies_comment": "Move rimraf to dependencies because it is used in the postinstall script.",
5151
"dependencies": {
5252
"@coder/logger": "1.1.16",
53-
"@coder/node-browser": "^1.0.8",
54-
"@coder/requirefs": "^1.1.5",
5553
"applicationinsights": "1.0.8",
5654
"chokidar": "3.4.3",
5755
"graceful-fs": "4.2.3",

lib/vscode/src/vs/server/browser/client.ts

-29
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Emitter } from 'vs/base/common/event';
21
import * as path from 'vs/base/common/path';
32
import { URI } from 'vs/base/common/uri';
43
import { localize } from 'vs/nls';
@@ -9,10 +8,8 @@ import { ILocalizationsService } from 'vs/platform/localizations/common/localiza
98
import { ILogService } from 'vs/platform/log/common/log';
109
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
1110
import { Registry } from 'vs/platform/registry/common/platform';
12-
import { PersistentConnectionEventType } from 'vs/platform/remote/common/remoteAgentConnection';
1311
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
1412
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
15-
import { INodeProxyService, NodeProxyChannelClient } from 'vs/server/common/nodeProxy';
1613
import { TelemetryChannelClient } from 'vs/server/common/telemetry';
1714
import { Options } from 'vs/server/ipc.d';
1815
import 'vs/workbench/contrib/localizations/browser/localizations.contribution';
@@ -63,33 +60,7 @@ Registry.as<IConfigurationRegistry>(Extensions.Configuration).registerConfigurat
6360
}
6461
});
6562

66-
class NodeProxyService extends NodeProxyChannelClient implements INodeProxyService {
67-
private readonly _onClose = new Emitter<void>();
68-
public readonly onClose = this._onClose.event;
69-
private readonly _onDown = new Emitter<void>();
70-
public readonly onDown = this._onDown.event;
71-
private readonly _onUp = new Emitter<void>();
72-
public readonly onUp = this._onUp.event;
73-
74-
public constructor(
75-
@IRemoteAgentService remoteAgentService: IRemoteAgentService,
76-
) {
77-
super(remoteAgentService.getConnection()!.getChannel('nodeProxy'));
78-
remoteAgentService.getConnection()!.onDidStateChange((state) => {
79-
switch (state.type) {
80-
case PersistentConnectionEventType.ConnectionGain:
81-
return this._onUp.fire();
82-
case PersistentConnectionEventType.ConnectionLost:
83-
return this._onDown.fire();
84-
case PersistentConnectionEventType.ReconnectionPermanentFailure:
85-
return this._onClose.fire();
86-
}
87-
});
88-
}
89-
}
90-
9163
registerSingleton(ILocalizationsService, LocalizationsService);
92-
registerSingleton(INodeProxyService, NodeProxyService);
9364
registerSingleton(ITelemetryService, TelemetryService);
9465

9566
/**

lib/vscode/src/vs/server/browser/extHostNodeProxy.ts

-51
This file was deleted.

lib/vscode/src/vs/server/browser/mainThreadNodeProxy.ts

-55
This file was deleted.

lib/vscode/src/vs/server/browser/worker.ts

-48
This file was deleted.

lib/vscode/src/vs/server/common/nodeProxy.ts

-47
This file was deleted.

lib/vscode/src/vs/server/node/channel.ts

+1-46
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { field, logger } from '@coder/logger';
2-
import { Server } from '@coder/node-browser';
32
import * as os from 'os';
43
import * as path from 'path';
54
import { VSBuffer } from 'vs/base/common/buffer';
@@ -21,7 +20,6 @@ import { ILogService } from 'vs/platform/log/common/log';
2120
import product from 'vs/platform/product/common/product';
2221
import { IRemoteAgentEnvironment, RemoteAgentConnectionContext } from 'vs/platform/remote/common/remoteAgentEnvironment';
2322
import { ITelemetryData, ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
24-
import { INodeProxyService } from 'vs/server/common/nodeProxy';
2523
import { getTranslations } from 'vs/server/node/nls';
2624
import { getUriTransformer } from 'vs/server/node/util';
2725
import { IFileChangeDto } from 'vs/workbench/api/common/extHost.protocol';
@@ -305,14 +303,7 @@ export class ExtensionEnvironmentChannel implements IServerChannel {
305303
const newPath = extension.extensionLocation.fsPath;
306304
this.log.warn(`${oldPath} has been overridden ${newPath}`);
307305
}
308-
uniqueExtensions.set(id, {
309-
...extension,
310-
// Force extensions that should run on the client due to latency
311-
// issues.
312-
extensionKind: extension.identifier.value === 'vscodevim.vim'
313-
? [ 'web' ]
314-
: extension.extensionKind,
315-
});
306+
uniqueExtensions.set(id, extension)
316307
});
317308
});
318309
});
@@ -337,42 +328,6 @@ export class ExtensionEnvironmentChannel implements IServerChannel {
337328
}
338329
}
339330

340-
export class NodeProxyService implements INodeProxyService {
341-
public _serviceBrand = undefined;
342-
343-
public readonly server: Server;
344-
345-
private readonly _onMessage = new Emitter<string>();
346-
public readonly onMessage = this._onMessage.event;
347-
private readonly _$onMessage = new Emitter<string>();
348-
public readonly $onMessage = this._$onMessage.event;
349-
public readonly _onDown = new Emitter<void>();
350-
public readonly onDown = this._onDown.event;
351-
public readonly _onUp = new Emitter<void>();
352-
public readonly onUp = this._onUp.event;
353-
354-
// Unused because the server connection will never permanently close.
355-
private readonly _onClose = new Emitter<void>();
356-
public readonly onClose = this._onClose.event;
357-
358-
public constructor() {
359-
// TODO: down/up
360-
this.server = new Server({
361-
onMessage: this.$onMessage,
362-
onClose: this.onClose,
363-
onDown: this.onDown,
364-
onUp: this.onUp,
365-
send: (message: string): void => {
366-
this._onMessage.fire(message);
367-
}
368-
});
369-
}
370-
371-
public send(message: string): void {
372-
this._$onMessage.fire(message);
373-
}
374-
}
375-
376331
class VariableResolverService extends AbstractVariableResolverService {
377332
constructor(
378333
remoteAuthority: string,

lib/vscode/src/vs/server/node/server.ts

+1-9
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,9 @@ import { TelemetryService } from 'vs/platform/telemetry/common/telemetryService'
4545
import { combinedAppender, NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
4646
import { AppInsightsAppender } from 'vs/platform/telemetry/node/appInsightsAppender';
4747
import { resolveCommonProperties } from 'vs/platform/telemetry/node/commonProperties';
48-
import { INodeProxyService, NodeProxyChannel } from 'vs/server/common/nodeProxy';
4948
import { TelemetryChannel } from 'vs/server/common/telemetry';
5049
import { Query, VscodeOptions, WorkbenchOptions } from 'vs/server/ipc';
51-
import { ExtensionEnvironmentChannel, FileProviderChannel, NodeProxyService, TerminalProviderChannel } from 'vs/server/node/channel';
50+
import { ExtensionEnvironmentChannel, FileProviderChannel, TerminalProviderChannel } from 'vs/server/node/channel';
5251
import { Connection, ExtensionHostConnection, ManagementConnection } from 'vs/server/node/connection';
5352
import { TelemetryClient } from 'vs/server/node/insights';
5453
import { logger } from 'vs/server/node/logger';
@@ -180,11 +179,6 @@ export class Vscode {
180179
this._onDidClientConnect.fire({
181180
protocol, onDidClientDisconnect: connection.onClose,
182181
});
183-
// TODO: Need a way to match clients with a connection. For now
184-
// dispose everything which only works because no extensions currently
185-
// utilize long-running proxies.
186-
(this.services.get(INodeProxyService) as NodeProxyService)._onUp.fire();
187-
connection.onClose(() => (this.services.get(INodeProxyService) as NodeProxyService)._onDown.fire());
188182
} else {
189183
const buffer = protocol.readEntireBuffer();
190184
connection = new ExtensionHostConnection(
@@ -279,7 +273,6 @@ export class Vscode {
279273
this.services.set(IExtensionManagementService, new SyncDescriptor(ExtensionManagementService));
280274
this.services.set(IExtensionGalleryService, new SyncDescriptor(ExtensionGalleryService));
281275
this.services.set(ILocalizationsService, new SyncDescriptor(LocalizationsService));
282-
this.services.set(INodeProxyService, new SyncDescriptor(NodeProxyService));
283276

284277
this.ipc.registerChannel('extensions', new ExtensionManagementChannel(
285278
accessor.get(IExtensionManagementService),
@@ -290,7 +283,6 @@ export class Vscode {
290283
));
291284
this.ipc.registerChannel('request', new RequestChannel(accessor.get(IRequestService)));
292285
this.ipc.registerChannel('telemetry', new TelemetryChannel(telemetryService));
293-
this.ipc.registerChannel('nodeProxy', new NodeProxyChannel(accessor.get(INodeProxyService)));
294286
this.ipc.registerChannel('localizations', <IServerChannel<any>>createChannelReceiver(accessor.get(ILocalizationsService)));
295287
this.ipc.registerChannel(REMOTE_FILE_SYSTEM_CHANNEL_NAME, new FileProviderChannel(environmentService, logService));
296288
this.ipc.registerChannel(REMOTE_TERMINAL_CHANNEL_NAME, new TerminalProviderChannel(logService));

lib/vscode/src/vs/workbench/api/browser/extensionHost.contribution.ts

-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ import './mainThreadComments';
6161
import './mainThreadNotebook';
6262
import './mainThreadTask';
6363
import './mainThreadLabelService';
64-
import 'vs/server/browser/mainThreadNodeProxy';
6564
import './mainThreadTunnelService';
6665
import './mainThreadAuthentication';
6766
import './mainThreadTimeline';

0 commit comments

Comments
 (0)