@@ -253,7 +253,7 @@ function hover(msg: p.RequestMessage) {
253
253
[ "hover" , filePath , params . position . line , params . position . character ] ,
254
254
msg
255
255
) ;
256
- send ( response ) ;
256
+ return response ;
257
257
}
258
258
259
259
function definition ( msg : p . RequestMessage ) {
@@ -265,7 +265,7 @@ function definition(msg: p.RequestMessage) {
265
265
[ "definition" , filePath , params . position . line , params . position . character ] ,
266
266
msg
267
267
) ;
268
- send ( response ) ;
268
+ return response ;
269
269
}
270
270
271
271
function references ( msg : p . RequestMessage ) {
@@ -276,13 +276,13 @@ function references(msg: p.RequestMessage) {
276
276
filePath ,
277
277
params . position
278
278
) ;
279
- let definitionResponse : m . ResponseMessage = {
279
+ let response : m . ResponseMessage = {
280
280
jsonrpc : c . jsonrpcVersion ,
281
281
id : msg . id ,
282
282
result,
283
283
// error: code and message set in case an exception happens during the definition request.
284
284
} ;
285
- send ( definitionResponse ) ;
285
+ return response ;
286
286
}
287
287
288
288
function rename ( msg : p . RequestMessage ) {
@@ -308,12 +308,12 @@ function rename(msg: p.RequestMessage) {
308
308
} ) ;
309
309
result = { changes } ;
310
310
}
311
- let renameResponse : m . ResponseMessage = {
311
+ let response : m . ResponseMessage = {
312
312
jsonrpc : c . jsonrpcVersion ,
313
313
id : msg . id ,
314
314
result,
315
315
} ;
316
- send ( renameResponse ) ;
316
+ return response ;
317
317
}
318
318
319
319
function documentSymbol ( msg : p . RequestMessage ) {
@@ -325,7 +325,7 @@ function documentSymbol(msg: p.RequestMessage) {
325
325
[ "documentSymbol" , filePath ] ,
326
326
msg
327
327
) ;
328
- send ( response ) ;
328
+ return response ;
329
329
}
330
330
331
331
function completion ( msg : p . RequestMessage ) {
@@ -346,7 +346,7 @@ function completion(msg: p.RequestMessage) {
346
346
msg
347
347
) ;
348
348
fs . unlink ( tmpname , ( ) => null ) ;
349
- send ( response ) ;
349
+ return response ;
350
350
}
351
351
352
352
function onMessage ( msg : m . Message ) {
@@ -459,17 +459,17 @@ function onMessage(msg: m.Message) {
459
459
send ( response ) ;
460
460
}
461
461
} else if ( msg . method === p . HoverRequest . method ) {
462
- hover ( msg ) ;
462
+ send ( hover ( msg ) ) ;
463
463
} else if ( msg . method === p . DefinitionRequest . method ) {
464
- definition ( msg ) ;
464
+ send ( definition ( msg ) ) ;
465
465
} else if ( msg . method === p . ReferencesRequest . method ) {
466
- references ( msg ) ;
466
+ send ( references ( msg ) ) ;
467
467
} else if ( msg . method === p . RenameRequest . method ) {
468
- rename ( msg ) ;
468
+ send ( rename ( msg ) ) ;
469
469
} else if ( msg . method === p . DocumentSymbolRequest . method ) {
470
- documentSymbol ( msg ) ;
470
+ send ( documentSymbol ( msg ) ) ;
471
471
} else if ( msg . method === p . CompletionRequest . method ) {
472
- completion ( msg ) ;
472
+ send ( completion ( msg ) ) ;
473
473
} else if ( msg . method === p . DocumentFormattingRequest . method ) {
474
474
// technically, a formatting failure should reply with the error. Sadly
475
475
// the LSP alert box for these error replies sucks (e.g. doesn't actually
0 commit comments