Skip to content

Commit

Permalink
Only pass the id parameter to types that use it
Browse files Browse the repository at this point in the history
  • Loading branch information
D4N committed Jan 23, 2023
1 parent b7e6e5c commit 95f3807
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions pygls/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,12 +581,10 @@ def send_request(self, method, params=None, callback=None, msg_id=None):
request_type = self.get_message_type(method) or JsonRPCRequestMessage
logger.debug('Sending request with id "%s": %s %s', msg_id, method, params)

request = request_type(
id=msg_id,
method=method,
params=params,
jsonrpc=JsonRPCProtocol.VERSION,
)
kwargs = {"method": method, "params": params, "jsonrpc": JsonRPCProtocol.VERSION}
if hasattr(request_type, "id"):
kwargs["id"] = msg_id
request = request_type(**kwargs)

future = Future()
# If callback function is given, call it when result is received
Expand Down

0 comments on commit 95f3807

Please sign in to comment.