Debian Codegraph @

LspCpp/include/LibLsp/lsp/textDocument/callHierarchy.h

raw
1 #pragma once
2
3 #include "LibLsp/lsp/lsAny.h"
4 #include "LibLsp/JsonRpc/RequestInMessage.h"
5 #include "LibLsp/JsonRpc/lsResponseMessage.h"
6 #include "LibLsp/lsp/symbol.h"
7 #include "LibLsp/lsp/lsTextDocumentPositionParams.h"
8 #include "LibLsp/lsp/lsRange.h"
9
10 enum class SymbolTag
11 {
12 Deprecated = 1
13 };
14 MAKE_REFLECT_TYPE_PROXY(SymbolTag)
15
16 struct CallHierarchyPrepareParams
17 {
18 lsTextDocumentIdentifier textDocument;
19 lsPosition position;
20
21 MAKE_SWAP_METHOD(CallHierarchyPrepareParams, textDocument, position)
22 };
23 MAKE_REFLECT_STRUCT(CallHierarchyPrepareParams, textDocument, position)
24
25 /// Represents programming constructs like functions or constructors
26 /// in the context of call hierarchy.
27 struct CallHierarchyItem
28 {
29 /// The name of this item.
30 std::string name;
31
32 /// The kind of this item.
33 SymbolKind kind;
34
35 /// Tags for this item.
36 optional<std::vector<SymbolTag>> tags;
37
38 /// More detaill for this item, e.g. the signature of a function.
39 optional<std::string> detail;
40
41 /// The resource identifier of this item.
42 lsDocumentUri uri;
43
44 /**
45 * The range enclosing this symbol not including leading/trailing whitespace
46 * but everything else, e.g. comments and code.
47 */
48 lsRange range;
49
50 /**
51 * The range that should be selected and revealed when this symbol is being
52 * picked, e.g. the name of a function. Must be contained by the
53 * [`range`](#CallHierarchyItem.range).
54 */
55 lsRange selectionRange;
56
57 /**
58 * A data entry field that is preserved between a call hierarchy prepare and
59 * incoming calls or outgoing calls requests.
60 */
61 optional<lsp::Any> data;
62 MAKE_SWAP_METHOD(CallHierarchyItem, name, kind, tags, detail, uri, range, selectionRange, data)
63 };
64 MAKE_REFLECT_STRUCT(CallHierarchyItem, name, kind, tags, detail, uri, range, selectionRange, data)
65
66 /// The parameter of a `callHierarchy/incomingCalls` request.
67 struct CallHierarchyIncomingCallsParams
68 {
69 CallHierarchyItem item;
70 MAKE_SWAP_METHOD(CallHierarchyIncomingCallsParams, item)
71 };
72 MAKE_REFLECT_STRUCT(CallHierarchyIncomingCallsParams, item)
73
74 /// Represents an incoming call, e.g. a caller of a method or constructor.
75 struct CallHierarchyIncomingCall
76 {
77 /// The item that makes the call.
78 CallHierarchyItem from;
79
80 /// The range at which the calls appear.
81 /// This is relative to the caller denoted by `From`.
82 std::vector<lsRange> fromRanges;
83 MAKE_SWAP_METHOD(CallHierarchyIncomingCall, from, fromRanges)
84 };
85 MAKE_REFLECT_STRUCT(CallHierarchyIncomingCall, from, fromRanges)
86
87 /// The parameter of a `callHierarchy/outgoingCalls` request.
88 struct CallHierarchyOutgoingCallsParams
89 {
90 CallHierarchyItem item;
91 MAKE_SWAP_METHOD(CallHierarchyOutgoingCallsParams, item)
92 };
93 MAKE_REFLECT_STRUCT(CallHierarchyOutgoingCallsParams, item)
94
95 /// Represents an outgoing call, e.g. calling a getter from a method or
96 /// a method from a constructor etc.
97 struct CallHierarchyOutgoingCall
98 {
99 /// The item that is called.
100 CallHierarchyItem to;
101
102 /// The range at which this item is called.
103 /// This is the range relative to the caller, and not `To`.
104 std::vector<lsRange> fromRanges;
105 MAKE_SWAP_METHOD(CallHierarchyOutgoingCall, to, fromRanges)
106 };
107 MAKE_REFLECT_STRUCT(CallHierarchyOutgoingCall, to, fromRanges)
108
109 DEFINE_REQUEST_RESPONSE_TYPE(
110 td_prepareCallHierarchy, CallHierarchyPrepareParams, optional<std::vector<CallHierarchyItem>>,
111 "textDocument/prepareCallHierarchy"
112 )
113
114 DEFINE_REQUEST_RESPONSE_TYPE(
115 td_incomingCalls, CallHierarchyIncomingCallsParams, optional<std::vector<CallHierarchyIncomingCall>>,
116 "callHierarchy/incomingCalls"
117 )
118
119 DEFINE_REQUEST_RESPONSE_TYPE(
120 td_outgoingCalls, CallHierarchyOutgoingCallsParams, optional<std::vector<CallHierarchyOutgoingCall>>,
121 "callHierarchy/CallHierarchyOutgoingCall"
122 )