@@ -341,43 +341,24 @@ function onMessage(msg: m.Message) {
341341 send ( response ) ;
342342 }
343343 } else if ( msg . method === p . HoverRequest . method ) {
344- let emptyHoverResponse : m . ResponseMessage = {
344+ let hoverResponse : m . ResponseMessage = {
345345 jsonrpc : c . jsonrpcVersion ,
346346 id : msg . id ,
347347 // type result = Hover | null
348348 // type Hover = {contents: MarkedString | MarkedString[] | MarkupContent, range?: Range}
349- result : null ,
349+ result : runHoverCommand ( msg ) ,
350350 } ;
351- let result = runHoverCommand ( msg ) ;
352- if ( result !== null ) {
353- let hoverResponse : m . ResponseMessage = {
354- ...emptyHoverResponse ,
355- result,
356- } ;
357- send ( hoverResponse ) ;
358- } else {
359- send ( emptyHoverResponse ) ;
360- }
351+ send ( hoverResponse ) ;
361352 } else if ( msg . method === p . DefinitionRequest . method ) {
362353 // https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_definition
363- let emptyDefinitionResponse : m . ResponseMessage = {
354+ let definitionResponse : m . ResponseMessage = {
364355 jsonrpc : c . jsonrpcVersion ,
365356 id : msg . id ,
366357 // result should be: Location | Array<Location> | Array<LocationLink> | null
367- result : null ,
358+ result : runDefinitionCommand ( msg ) ,
368359 // error: code and message set in case an exception happens during the definition request.
369360 } ;
370-
371- let result = runDefinitionCommand ( msg ) ;
372- if ( result !== null ) {
373- let definitionResponse : m . ResponseMessage = {
374- ...emptyDefinitionResponse ,
375- result : result ,
376- } ;
377- send ( definitionResponse ) ;
378- } else {
379- send ( emptyDefinitionResponse ) ;
380- }
361+ send ( definitionResponse ) ;
381362 } else if ( msg . method === p . CompletionRequest . method ) {
382363 let code = getOpenedFileContent ( msg . params . textDocument . uri ) ;
383364 let completionResponse : m . ResponseMessage = {
0 commit comments