[lsp] simplify location to range conversion
[lsp] simplify location to range conversion

This conversion is done in many places and a lot of duplicated code can
be removed by extracting it to a function.

Signed-off-by: Rudi Grinberg <4c46c202a3b8207ad5740134b125aae40c6c67a8@gmail.com>

rgrinberg/merlin,ocaml/merlin,ocaml/merlin,the-lambda-church/merlin,ocaml/merlin,rgrinberg/merlin,ocaml/merlin,dra27/merlin,dra27/merlin,the-lambda-church/merlin,dra27/merlin,rgrinberg/merlin,rgrinberg/merlin,the-lambda-church/merlin,dra27/merlin