File: callHierarchy.h

package info (click to toggle)
asymptote 3.02%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 33,400 kB
  • sloc: cpp: 172,516; ansic: 69,728; python: 14,967; sh: 5,599; javascript: 4,866; lisp: 1,507; perl: 1,417; makefile: 1,028; yacc: 610; lex: 449; xml: 182; asm: 8
file content (122 lines) | stat: -rw-r--r-- 3,880 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#pragma once

#include "LibLsp/lsp/lsAny.h"
#include "LibLsp/JsonRpc/RequestInMessage.h"
#include "LibLsp/JsonRpc/lsResponseMessage.h"
#include "LibLsp/lsp/symbol.h"
#include "LibLsp/lsp/lsTextDocumentPositionParams.h"
#include "LibLsp/lsp/lsRange.h"

enum class SymbolTag
{
    Deprecated = 1
};
MAKE_REFLECT_TYPE_PROXY(SymbolTag)

struct CallHierarchyPrepareParams
{
    lsTextDocumentIdentifier textDocument;
    lsPosition position;

    MAKE_SWAP_METHOD(CallHierarchyPrepareParams, textDocument, position)
};
MAKE_REFLECT_STRUCT(CallHierarchyPrepareParams, textDocument, position)

/// Represents programming constructs like functions or constructors
/// in the context of call hierarchy.
struct CallHierarchyItem
{
    /// The name of this item.
    std::string name;

    /// The kind of this item.
    SymbolKind kind;

    /// Tags for this item.
    optional<std::vector<SymbolTag>> tags;

    /// More detaill for this item, e.g. the signature of a function.
    optional<std::string> detail;

    /// The resource identifier of this item.
    lsDocumentUri uri;

    /**
         * The range enclosing this symbol not including leading/trailing whitespace
         * but everything else, e.g. comments and code.
         */
    lsRange range;

    /**
         * The range that should be selected and revealed when this symbol is being
         * picked, e.g. the name of a function. Must be contained by the
         * [`range`](#CallHierarchyItem.range).
         */
    lsRange selectionRange;

    /**
         * A data entry field that is preserved between a call hierarchy prepare and
         * incoming calls or outgoing calls requests.
         */
    optional<lsp::Any> data;
    MAKE_SWAP_METHOD(CallHierarchyItem, name, kind, tags, detail, uri, range, selectionRange, data)
};
MAKE_REFLECT_STRUCT(CallHierarchyItem, name, kind, tags, detail, uri, range, selectionRange, data)

/// The parameter of a `callHierarchy/incomingCalls` request.
struct CallHierarchyIncomingCallsParams
{
    CallHierarchyItem item;
    MAKE_SWAP_METHOD(CallHierarchyIncomingCallsParams, item)
};
MAKE_REFLECT_STRUCT(CallHierarchyIncomingCallsParams, item)

/// Represents an incoming call, e.g. a caller of a method or constructor.
struct CallHierarchyIncomingCall
{
    /// The item that makes the call.
    CallHierarchyItem from;

    /// The range at which the calls appear.
    /// This is relative to the caller denoted by `From`.
    std::vector<lsRange> fromRanges;
    MAKE_SWAP_METHOD(CallHierarchyIncomingCall, from, fromRanges)
};
MAKE_REFLECT_STRUCT(CallHierarchyIncomingCall, from, fromRanges)

/// The parameter of a `callHierarchy/outgoingCalls` request.
struct CallHierarchyOutgoingCallsParams
{
    CallHierarchyItem item;
    MAKE_SWAP_METHOD(CallHierarchyOutgoingCallsParams, item)
};
MAKE_REFLECT_STRUCT(CallHierarchyOutgoingCallsParams, item)

/// Represents an outgoing call, e.g. calling a getter from a method or
/// a method from a constructor etc.
struct CallHierarchyOutgoingCall
{
    /// The item that is called.
    CallHierarchyItem to;

    /// The range at which this item is called.
    /// This is the range relative to the caller, and not `To`.
    std::vector<lsRange> fromRanges;
    MAKE_SWAP_METHOD(CallHierarchyOutgoingCall, to, fromRanges)
};
MAKE_REFLECT_STRUCT(CallHierarchyOutgoingCall, to, fromRanges)

DEFINE_REQUEST_RESPONSE_TYPE(
    td_prepareCallHierarchy, CallHierarchyPrepareParams, optional<std::vector<CallHierarchyItem>>,
    "textDocument/prepareCallHierarchy"
)

DEFINE_REQUEST_RESPONSE_TYPE(
    td_incomingCalls, CallHierarchyIncomingCallsParams, optional<std::vector<CallHierarchyIncomingCall>>,
    "callHierarchy/incomingCalls"
)

DEFINE_REQUEST_RESPONSE_TYPE(
    td_outgoingCalls, CallHierarchyOutgoingCallsParams, optional<std::vector<CallHierarchyOutgoingCall>>,
    "callHierarchy/CallHierarchyOutgoingCall"
)