Call function req and then emit its results to the LSP server.

def request(req=None, method=None, requires_response=True):
    """Call function req and then emit its results to the LSP server."""
    if req is None:
        return functools.partial(request, method=method,
                                 requires_response=requires_response)

    @functools.wraps(req)
    def wrapper(self, *args, **kwargs):
        if self.lsp_ready:
            params = req(self, *args, **kwargs)
            if params is not None:
                self.emit_request(method, params, requires_response)
    return wrapper