Skip to content

Commit f20f8e3

Browse files
committed
Refactor: send in the called of the command.
1 parent bb96959 commit f20f8e3

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

server/src/server.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ function hover(msg: p.RequestMessage) {
253253
["hover", filePath, params.position.line, params.position.character],
254254
msg
255255
);
256-
send(response);
256+
return response;
257257
}
258258

259259
function definition(msg: p.RequestMessage) {
@@ -265,7 +265,7 @@ function definition(msg: p.RequestMessage) {
265265
["definition", filePath, params.position.line, params.position.character],
266266
msg
267267
);
268-
send(response);
268+
return response;
269269
}
270270

271271
function references(msg: p.RequestMessage) {
@@ -276,13 +276,13 @@ function references(msg: p.RequestMessage) {
276276
filePath,
277277
params.position
278278
);
279-
let definitionResponse: m.ResponseMessage = {
279+
let response: m.ResponseMessage = {
280280
jsonrpc: c.jsonrpcVersion,
281281
id: msg.id,
282282
result,
283283
// error: code and message set in case an exception happens during the definition request.
284284
};
285-
send(definitionResponse);
285+
return response;
286286
}
287287

288288
function rename(msg: p.RequestMessage) {
@@ -308,12 +308,12 @@ function rename(msg: p.RequestMessage) {
308308
});
309309
result = { changes };
310310
}
311-
let renameResponse: m.ResponseMessage = {
311+
let response: m.ResponseMessage = {
312312
jsonrpc: c.jsonrpcVersion,
313313
id: msg.id,
314314
result,
315315
};
316-
send(renameResponse);
316+
return response;
317317
}
318318

319319
function documentSymbol(msg: p.RequestMessage) {
@@ -325,7 +325,7 @@ function documentSymbol(msg: p.RequestMessage) {
325325
["documentSymbol", filePath],
326326
msg
327327
);
328-
send(response);
328+
return response;
329329
}
330330

331331
function completion(msg: p.RequestMessage) {
@@ -346,7 +346,7 @@ function completion(msg: p.RequestMessage) {
346346
msg
347347
);
348348
fs.unlink(tmpname, () => null);
349-
send(response);
349+
return response;
350350
}
351351

352352
function onMessage(msg: m.Message) {
@@ -459,17 +459,17 @@ function onMessage(msg: m.Message) {
459459
send(response);
460460
}
461461
} else if (msg.method === p.HoverRequest.method) {
462-
hover(msg);
462+
send(hover(msg));
463463
} else if (msg.method === p.DefinitionRequest.method) {
464-
definition(msg);
464+
send(definition(msg));
465465
} else if (msg.method === p.ReferencesRequest.method) {
466-
references(msg);
466+
send(references(msg));
467467
} else if (msg.method === p.RenameRequest.method) {
468-
rename(msg);
468+
send(rename(msg));
469469
} else if (msg.method === p.DocumentSymbolRequest.method) {
470-
documentSymbol(msg);
470+
send(documentSymbol(msg));
471471
} else if (msg.method === p.CompletionRequest.method) {
472-
completion(msg);
472+
send(completion(msg));
473473
} else if (msg.method === p.DocumentFormattingRequest.method) {
474474
// technically, a formatting failure should reply with the error. Sadly
475475
// the LSP alert box for these error replies sucks (e.g. doesn't actually

0 commit comments

Comments
 (0)