mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 08:24:39 +00:00
Skip LSP cancellation handling for Notification requests
Change-Id: I0edf6206db66ed07390dafcd5ea72bb2397468fc Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104300 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Danny Tuppeny <dantup@google.com>
This commit is contained in:
parent
edae8c474c
commit
190599de78
|
@ -121,16 +121,14 @@ abstract class ServerStateMessageHandler {
|
||||||
return handleUnknownMessage(message);
|
return handleUnknownMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (message is! RequestMessage) {
|
||||||
|
return handler.handleMessage(message, _notCancelableToken);
|
||||||
|
}
|
||||||
|
|
||||||
// Create a cancellation token that will allow us to cancel this request if
|
// Create a cancellation token that will allow us to cancel this request if
|
||||||
// requested to save processing (the handler will need to specifically
|
// requested to save processing (the handler will need to specifically
|
||||||
// check the token after `await` points).
|
// check the token after `await` points).
|
||||||
//
|
final token = _cancelHandler.createToken(message);
|
||||||
// Notifications cannot be cancelled so they get a fake token that will never
|
|
||||||
// cancel so that they can share the same APIs with cancellable requests.
|
|
||||||
final token = message is RequestMessage
|
|
||||||
? _cancelHandler.createToken(message)
|
|
||||||
: _notCancelableToken;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final result = await handler.handleMessage(message, token);
|
final result = await handler.handleMessage(message, token);
|
||||||
// Do a final check before returning the result, because if the request was
|
// Do a final check before returning the result, because if the request was
|
||||||
|
@ -141,9 +139,7 @@ abstract class ServerStateMessageHandler {
|
||||||
await Future.delayed(Duration.zero);
|
await Future.delayed(Duration.zero);
|
||||||
return token.isCancellationRequested ? cancelled() : result;
|
return token.isCancellationRequested ? cancelled() : result;
|
||||||
} finally {
|
} finally {
|
||||||
if (message is RequestMessage) {
|
_cancelHandler.clearToken(message);
|
||||||
_cancelHandler.clearToken(message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue