Skip to content

Commit 65191d0

Browse files
committed
chore: rename process to lsProcess to prevent shadowing
with node process
1 parent 49abb87 commit 65191d0

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

lib/auto-languageclient.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ export default class AutoLanguageClient {
117117
}
118118

119119
/** (Optional) Return the parameters used to initialize a client - you may want to extend capabilities */
120-
protected getInitializeParams(projectPath: string, process: LanguageServerProcess): ls.InitializeParams {
120+
protected getInitializeParams(projectPath: string, lsProcess: LanguageServerProcess): ls.InitializeParams {
121121
return {
122-
processId: process.pid,
122+
processId: lsProcess.pid,
123123
rootPath: projectPath,
124124
rootUri: Convert.pathToUri(projectPath),
125125
workspaceFolders: null,
@@ -312,14 +312,14 @@ export default class AutoLanguageClient {
312312

313313
/** Starts the server by starting the process, then initializing the language server and starting adapters */
314314
private async startServer(projectPath: string): Promise<ActiveServer> {
315-
const process = await this.reportBusyWhile(
315+
const lsProcess = await this.reportBusyWhile(
316316
`Starting ${this.getServerName()} for ${path.basename(projectPath)}`,
317317
async () => this.startServerProcess(projectPath),
318318
);
319-
this.captureServerErrors(process, projectPath);
320-
const connection = new LanguageClientConnection(this.createRpcConnection(process), this.logger);
319+
this.captureServerErrors(lsProcess, projectPath);
320+
const connection = new LanguageClientConnection(this.createRpcConnection(lsProcess), this.logger);
321321
this.preInitialization(connection);
322-
const initializeParams = this.getInitializeParams(projectPath, process);
322+
const initializeParams = this.getInitializeParams(projectPath, lsProcess);
323323
const initialization = connection.initialize(initializeParams);
324324
this.reportBusyWhile(
325325
`${this.getServerName()} initializing for ${path.basename(projectPath)}`,
@@ -328,7 +328,7 @@ export default class AutoLanguageClient {
328328
const initializeResponse = await initialization;
329329
const newServer = {
330330
projectPath,
331-
process,
331+
process: lsProcess,
332332
connection,
333333
capabilities: initializeResponse.capabilities,
334334
disposable: new CompositeDisposable(),
@@ -366,11 +366,11 @@ export default class AutoLanguageClient {
366366
return newServer;
367367
}
368368

369-
private captureServerErrors(childProcess: LanguageServerProcess, projectPath: string): void {
370-
childProcess.on('error', (err) => this.handleSpawnFailure(err));
371-
childProcess.on('exit', (code, signal) => this.logger.debug(`exit: code ${code} signal ${signal}`));
372-
childProcess.stderr.setEncoding('utf8');
373-
childProcess.stderr.on('data', (chunk: Buffer) => {
369+
private captureServerErrors(lsProcess: LanguageServerProcess, projectPath: string): void {
370+
lsProcess.on('error', (err) => this.handleSpawnFailure(err));
371+
lsProcess.on('exit', (code, signal) => this.logger.debug(`exit: code ${code} signal ${signal}`));
372+
lsProcess.stderr.setEncoding('utf8');
373+
lsProcess.stderr.on('data', (chunk: Buffer) => {
374374
const errorString = chunk.toString();
375375
this.handleServerStderr(errorString, projectPath);
376376
// Keep the last 5 lines for packages to use in messages
@@ -392,22 +392,22 @@ export default class AutoLanguageClient {
392392
}
393393

394394
/** Creates the RPC connection which can be ipc, socket or stdio */
395-
private createRpcConnection(process: LanguageServerProcess): rpc.MessageConnection {
395+
private createRpcConnection(lsProcess: LanguageServerProcess): rpc.MessageConnection {
396396
let reader: rpc.MessageReader;
397397
let writer: rpc.MessageWriter;
398398
const connectionType = this.getConnectionType();
399399
switch (connectionType) {
400400
case 'ipc':
401-
reader = new rpc.IPCMessageReader(process as cp.ChildProcess);
402-
writer = new rpc.IPCMessageWriter(process as cp.ChildProcess);
401+
reader = new rpc.IPCMessageReader(lsProcess as cp.ChildProcess);
402+
writer = new rpc.IPCMessageWriter(lsProcess as cp.ChildProcess);
403403
break;
404404
case 'socket':
405405
reader = new rpc.SocketMessageReader(this.socket);
406406
writer = new rpc.SocketMessageWriter(this.socket);
407407
break;
408408
case 'stdio':
409-
reader = new rpc.StreamMessageReader(process.stdout);
410-
writer = new rpc.StreamMessageWriter(process.stdin);
409+
reader = new rpc.StreamMessageReader(lsProcess.stdout);
410+
writer = new rpc.StreamMessageWriter(lsProcess.stdin);
411411
break;
412412
default:
413413
return Utils.assertUnreachable(connectionType);

0 commit comments

Comments
 (0)