1//===-- CancelRequestHandler.cpp ------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "Handler/RequestHandler.h"
10#include "Protocol/ProtocolRequests.h"
11#include "llvm/Support/Error.h"
12
13using namespace llvm;
14using namespace lldb_dap::protocol;
15
16namespace lldb_dap {
17
18/// The `cancel` request is used by the client in two situations:
19///
20/// - to indicate that it is no longer interested in the result produced by a
21/// specific request issued earlier
22/// - to cancel a progress sequence.
23///
24/// Clients should only call this request if the corresponding capability
25/// `supportsCancelRequest` is true.
26///
27/// This request has a hint characteristic: a debug adapter can only be
28/// expected to make a 'best effort' in honoring this request but there are no
29/// guarantees.
30///
31/// The `cancel` request may return an error if it could not cancel
32/// an operation but a client should refrain from presenting this error to end
33/// users.
34///
35/// The request that got cancelled still needs to send a response back.
36/// This can either be a normal result (`success` attribute true) or an error
37/// response (`success` attribute false and the `message` set to `cancelled`).
38///
39/// Returning partial results from a cancelled request is possible but please
40/// note that a client has no generic way for detecting that a response is
41/// partial or not.
42///
43/// The progress that got cancelled still needs to send a `progressEnd` event
44/// back.
45///
46/// A client cannot assume that progress just got cancelled after sending
47/// the `cancel` request.
48Error CancelRequestHandler::Run(const CancelArguments &arguments) const {
49 // Cancel support is built into the DAP::Loop handler for detecting
50 // cancellations of pending or inflight requests.
51 dap.ClearCancelRequest(arguments);
52 return Error::success();
53}
54
55} // namespace lldb_dap
56

source code of lldb/tools/lldb-dap/Handler/CancelRequestHandler.cpp