Skip to content

Commit eaf63de

Browse files
committed
fix(lib/vscode): fix return type shutdown in ptyService
In the squash/merge update, we forgot to update the return type. Add Promise<void> instead of void for shutdown method.
1 parent cc8e4ee commit eaf63de

File tree

2 files changed

+32
-8
lines changed

2 files changed

+32
-8
lines changed

lib/vscode/src/vs/platform/terminal/node/ptyService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ export class PersistentTerminalProcess extends Disposable {
305305
}
306306
return undefined;
307307
}
308-
shutdown(immediate: boolean): void {
308+
shutdown(immediate: boolean): Promise<void> {
309309
return this._terminalProcess.shutdown(immediate);
310310
}
311311
input(data: string): void {

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

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Emitter } from 'vs/base/common/event';
77
import { Schemas } from 'vs/base/common/network';
88
import { URI } from 'vs/base/common/uri';
99
import { getMachineId } from 'vs/base/node/id';
10-
import { ClientConnectionEvent, createChannelReceiver, IPCServer, IServerChannel } from 'vs/base/parts/ipc/common/ipc';
10+
import { ClientConnectionEvent, IPCServer, IServerChannel, ProxyChannel, StaticRouter } from 'vs/base/parts/ipc/common/ipc';
1111
import { LogsDataCleaner } from 'vs/code/electron-browser/sharedProcess/contrib/logsDataCleaner';
1212
import { main } from 'vs/code/node/cliProcessMain';
1313
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
@@ -28,10 +28,10 @@ import { InstantiationService } from 'vs/platform/instantiation/common/instantia
2828
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
2929
import { ILocalizationsService } from 'vs/platform/localizations/common/localizations';
3030
import { LocalizationsService } from 'vs/platform/localizations/node/localizations';
31-
import { getLogLevel, ILoggerService, ILogService } from 'vs/platform/log/common/log';
32-
import { LoggerChannel } from 'vs/platform/log/common/logIpc';
31+
import { ConsoleLogger, getLogLevel, ILoggerService, ILogService, MultiplexLogService } from 'vs/platform/log/common/log';
32+
import { FollowerLogService, LoggerChannel, LoggerChannelClient } from 'vs/platform/log/common/logIpc';
3333
import { LoggerService } from 'vs/platform/log/node/loggerService';
34-
import { SpdLogService } from 'vs/platform/log/node/spdlogService';
34+
import { SpdLogLogger } from 'vs/platform/log/node/spdlogLog';
3535
import product from 'vs/platform/product/common/product';
3636
import { IProductService } from 'vs/platform/product/common/productService';
3737
import { ConnectionType, ConnectionTypeRequest } from 'vs/platform/remote/common/remoteAgentConnection';
@@ -212,11 +212,27 @@ export class Vscode {
212212
}
213213

214214
private async initializeServices(args: NativeParsedArgs): Promise<void> {
215+
/*
216+
NOTE@coder: this initializeServices is loosely based off this file:
217+
https://github.com/cdr/code-server/blob/main/lib/vscode/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts#L148
218+
219+
If upstream changes cause conflicts, look there ^.
220+
*/
215221
const environmentService = new NativeEnvironmentService(args);
216222
// https://github.com/cdr/code-server/issues/1693
217223
fs.mkdirSync(environmentService.globalStorageHome.fsPath, { recursive: true });
218-
219-
const logService = new SpdLogService(RemoteExtensionLogFileName, environmentService.logsPath, getLogLevel(environmentService));
224+
/*
225+
NOTE@coder: Made these updates on 3/11/21 by @jsjoeio
226+
based on this file (and lines):
227+
https://github.com/cdr/code-server/blob/main/lib/vscode/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts#L144-L149
228+
*/
229+
const mainRouter = new StaticRouter(ctx => ctx === 'main')
230+
const loggerClient = new LoggerChannelClient(this.ipc.getChannel('logger', mainRouter))
231+
const multiplexLogger = new MultiplexLogService([
232+
new ConsoleLogger(getLogLevel(environmentService)),
233+
new SpdLogLogger(RemoteExtensionLogFileName, environmentService.logsPath, false, getLogLevel(environmentService))
234+
])
235+
const logService = new FollowerLogService(loggerClient, multiplexLogger)
220236
const fileService = new FileService(logService);
221237
fileService.registerProvider(Schemas.file, new DiskFileSystemProvider(logService));
222238

@@ -286,7 +302,15 @@ export class Vscode {
286302
));
287303
this.ipc.registerChannel('request', new RequestChannel(accessor.get(IRequestService)));
288304
this.ipc.registerChannel('telemetry', new TelemetryChannel(telemetryService));
289-
this.ipc.registerChannel('localizations', <IServerChannel<any>>createChannelReceiver(accessor.get(ILocalizationsService)));
305+
/*
306+
NOTE@coder: they renamed createChannelReceiver and made it part of the ProxyChannel namespace
307+
See: https://github.com/microsoft/vscode/commit/e371faebfb679ca0dcdb61f4f2f33b3d69922a77
308+
309+
And see this as an example similar to our code below:
310+
https://github.com/microsoft/vscode/blob/e371faebfb679ca0dcdb61f4f2f33b3d69922a77/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts#L273
311+
3/11/2021 by @jsjoeio
312+
*/
313+
this.ipc.registerChannel('localizations', <IServerChannel<any>>ProxyChannel.fromService(accessor.get(ILocalizationsService)));
290314
this.ipc.registerChannel(REMOTE_FILE_SYSTEM_CHANNEL_NAME, new FileProviderChannel(environmentService, logService));
291315
this.ipc.registerChannel(REMOTE_TERMINAL_CHANNEL_NAME, new TerminalProviderChannel(logService));
292316
resolve(new ErrorTelemetry(telemetryService));

0 commit comments

Comments
 (0)