Debian Codegraph @

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

raw
1 #pragma once
2
3 #include "LibLsp/JsonRpc/RequestInMessage.h"
4 #include "LibLsp/JsonRpc/lsResponseMessage.h"
5 #include "LibLsp/lsp/lsMarkedString.h"
6 #include "LibLsp/lsp/lsTextDocumentPositionParams.h"
7
8 // Represents a parameter of a callable-signature. A parameter can
9 // have a label and a doc-comment.
10 struct lsParameterInformation
11 {
12 // The label of this parameter. Will be shown in
13 // the UI.
14 std::string label;
15
16 // The human-readable doc-comment of this parameter. Will be shown
17 // in the UI but can be omitted.
18 optional<std::pair<optional<std::string>, optional<MarkupContent>>> documentation;
19
20 MAKE_SWAP_METHOD(lsParameterInformation, label, documentation)
21 };
22 MAKE_REFLECT_STRUCT(lsParameterInformation, label, documentation);
23
24 // Represents the signature of something callable. A signature
25 // can have a label, like a function-name, a doc-comment, and
26 // a set of parameters.
27 struct lsSignatureInformation
28 {
29 // The label of this signature. Will be shown in
30 // the UI.
31 std::string label;
32
33 // The human-readable doc-comment of this signature. Will be shown
34 // in the UI but can be omitted.
35 optional<std::pair<optional<std::string>, optional<MarkupContent>>> documentation;
36
37 // The parameters of this signature.
38 std::vector<lsParameterInformation> parameters;
39
40 MAKE_SWAP_METHOD(lsSignatureInformation, label, documentation, parameters)
41 };
42 MAKE_REFLECT_STRUCT(lsSignatureInformation, label, documentation, parameters);
43
44 // Signature help represents the signature of something
45 // callable. There can be multiple signature but only one
46 // active and only one active parameter.
47 struct lsSignatureHelp
48 {
49 // One or more signatures.
50 std::vector<lsSignatureInformation> signatures;
51
52 // The active signature. If omitted or the value lies outside the
53 // range of `signatures` the value defaults to zero or is ignored if
54 // `signatures.length === 0`. Whenever possible implementors should
55 // make an active decision about the active signature and shouldn't
56 // rely on a default value.
57 // In future version of the protocol this property might become
58 // mandantory to better express this.
59 optional<int> activeSignature;
60
61 // The active parameter of the active signature. If omitted or the value
62 // lies outside the range of `signatures[activeSignature].parameters`
63 // defaults to 0 if the active signature has parameters. If
64 // the active signature has no parameters it is ignored.
65 // In future version of the protocol this property might become
66 // mandantory to better express the active parameter if the
67 // active signature does have any.
68 optional<int> activeParameter;
69
70 MAKE_SWAP_METHOD(lsSignatureHelp, signatures, activeSignature, activeParameter)
71 };
72 MAKE_REFLECT_STRUCT(lsSignatureHelp, signatures, activeSignature, activeParameter);
73
74 /**
75 * The signature help request is sent from the client to the server to
76 * request signature information at a given cursor position.
77 *
78 * Registration Options: SignatureHelpRegistrationOptions
79 */
80 DEFINE_REQUEST_RESPONSE_TYPE(
81 td_signatureHelp, lsTextDocumentPositionParams, lsSignatureHelp, "textDocument/signatureHelp"
82 );