Skip to content

Commit ae02023

Browse files
committed
fix(lib/vscode): register LogLevelChannel
1 parent 050a1bb commit ae02023

File tree

4 files changed

+28
-53
lines changed

4 files changed

+28
-53
lines changed

lib/vscode/src/vs/base/node/languagePacks.js

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -71,50 +71,6 @@
7171
* @returns {object}
7272
*/
7373
function getLanguagePackConfigurations(userDataPath) {
74-
const configFile = path.join(userDataPath, 'languagepacks.json');
75-
try {
76-
return nodeRequire(configFile);
77-
} catch (err) {
78-
// Do nothing. If we can't read the file we have no
79-
// language pack config.
80-
}
81-
}
82-
83-
function readFile(file) {
84-
return new Promise(function (resolve, reject) {
85-
fs.readFile(file, 'utf8', function (err, data) {
86-
if (err) {
87-
reject(err);
88-
return;
89-
}
90-
resolve(data);
91-
});
92-
});
93-
}
94-
95-
/**
96-
* @param {string} file
97-
* @param {string} content
98-
* @returns {Promise<void>}
99-
*/
100-
function writeFile(file, content) {
101-
return new Promise(function (resolve, reject) {
102-
fs.writeFile(file, content, 'utf8', function (err) {
103-
if (err) {
104-
reject(err);
105-
return;
106-
}
107-
resolve();
108-
});
109-
});
110-
}
111-
112-
113-
/**
114-
* @param {string} userDataPath
115-
* @returns {object}
116-
*/
117-
function getLanguagePackConfigurations(userDataPath) {
11874
const configFile = path.join(userDataPath, 'languagepacks.json');
11975
try {
12076
// NOTE@coder: Swapped require with readFile since require is cached and

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,11 @@ export class ExtensionEnvironmentChannel implements IServerChannel {
330330
}
331331
}
332332

333+
/*
334+
NOTE@coder:
335+
Reference: - ../../workbench/api/common/extHostDebugService.ts
336+
3/16/21 jsjoeio
337+
*/
333338
class VariableResolverService extends AbstractVariableResolverService {
334339
constructor(
335340
remoteAuthority: string,
@@ -355,7 +360,7 @@ class VariableResolverService extends AbstractVariableResolverService {
355360
NOTE@coder: not sure where we could get this from. This is new.
356361
@jsjoeio 3/11/21
357362
*/
358-
return undefined;
363+
return (args.resolverEnv && args.resolverEnv['VSCODE_CWD']) || env['VSCODE_CWD'] || process.cwd();
359364
},
360365
getExecPath: (): string | undefined => {
361366
// Assuming that resolverEnv is just for use in the resolver and not for

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { ServiceCollection } from 'vs/platform/instantiation/common/serviceColle
2929
import { ILocalizationsService } from 'vs/platform/localizations/common/localizations';
3030
import { LocalizationsService } from 'vs/platform/localizations/node/localizations';
3131
import { ConsoleLogger, getLogLevel, ILoggerService, ILogService, MultiplexLogService } from 'vs/platform/log/common/log';
32-
import { LoggerChannel } from 'vs/platform/log/common/logIpc';
32+
import { LogLevelChannel } from 'vs/platform/log/common/logIpc';
3333
import { LoggerService } from 'vs/platform/log/node/loggerService';
3434
import { SpdLogLogger } from 'vs/platform/log/node/spdlogLog';
3535
import product from 'vs/platform/product/common/product';
@@ -214,7 +214,7 @@ export class Vscode {
214214
private async initializeServices(args: NativeParsedArgs): Promise<void> {
215215
/*
216216
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
217+
Reference: - ../../electron-browser/sharedProcess/sharedProcessMain.ts#L148
218218
219219
If upstream changes cause conflicts, look there ^.
220220
3/11/21 @jsjoeio
@@ -224,7 +224,7 @@ export class Vscode {
224224
fs.mkdirSync(environmentService.globalStorageHome.fsPath, { recursive: true });
225225
/*
226226
NOTE@coder: Made these updates on 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
227+
Reference: - ../../electron-browser/sharedProcess/sharedProcessMain.ts#L144-L149
228228
229229
More details (from @code-asher):
230230
I think the logLevel channel is only used in the electron version of vscode so we can probably skip it.
@@ -234,7 +234,7 @@ export class Vscode {
234234
*/
235235
const logService = new MultiplexLogService([
236236
new ConsoleLogger(getLogLevel(environmentService)),
237-
new SpdLogLogger(RemoteExtensionLogFileName, path.join(environmentService.logsPath, 'server.log'), false, getLogLevel(environmentService))
237+
new SpdLogLogger(RemoteExtensionLogFileName, path.join(environmentService.logsPath, `${RemoteExtensionLogFileName}.log`), false, getLogLevel(environmentService))
238238
]);
239239
const fileService = new FileService(logService);
240240
fileService.registerProvider(Schemas.file, new DiskFileSystemProvider(logService));
@@ -250,7 +250,13 @@ export class Vscode {
250250
...environmentService.extraBuiltinExtensionPaths,
251251
];
252252

253-
this.ipc.registerChannel('logger', new LoggerChannel(loggerService));
253+
/*
254+
NOTE@coder: we changed this channel registration from LogLevel to LogLevelChannel
255+
because it changed upstream.
256+
257+
3/15/21 jsjoeio
258+
*/
259+
this.ipc.registerChannel('logger', new LogLevelChannel(logService));
254260
this.ipc.registerChannel(ExtensionHostDebugBroadcastChannel.ChannelName, new ExtensionHostDebugBroadcastChannel());
255261

256262
this.services.set(ILogService, logService);

lib/vscode/src/vs/workbench/services/localizations/electron-sandbox/localizationsService.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,26 @@
55

66
import { ProxyChannel } from 'vs/base/parts/ipc/common/ipc';
77
import { ILocalizationsService } from 'vs/platform/localizations/common/localizations';
8-
import { ISharedProcessService } from 'vs/platform/ipc/electron-sandbox/services';
98
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
9+
import { IRemoteAgentService } from '../../remote/common/remoteAgentService';
1010

1111
// @ts-ignore: interface is implemented via proxy
1212
export class LocalizationsService implements ILocalizationsService {
1313

1414
declare readonly _serviceBrand: undefined;
1515

1616
constructor(
17-
@ISharedProcessService sharedProcessService: ISharedProcessService,
17+
@IRemoteAgentService remoteAgentService: IRemoteAgentService,
1818
) {
19-
return ProxyChannel.toService<ILocalizationsService>(sharedProcessService.getChannel('localizations'));
19+
/*
20+
NOTE@coder:
21+
Upstream, they use the ISharedProcessService.
22+
23+
We run this on the browser where there is no shared process so it needs to connect
24+
to the localization channel through the remote agent.
25+
3/16/21 jsjoeio code-asher
26+
*/
27+
return ProxyChannel.toService<ILocalizationsService>(remoteAgentService.getConnection()!.getChannel('localizations'));
2028
}
2129
}
2230

0 commit comments

Comments
 (0)