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
|
#pragma once
#include "LibLsp/JsonRpc/RequestInMessage.h"
#include "LibLsp/JsonRpc/lsResponseMessage.h"
#include <regex>
#include "LibLsp/lsp/lsp_completion.h"
#include "LibLsp/lsp/lsTextDocumentPositionParams.h"
// How a completion was triggered
enum class lsCompletionTriggerKind {
// Completion was triggered by typing an identifier (24x7 code
// complete), manual invocation (e.g Ctrl+Space) or via API.
Invoked = 1,
// Completion was triggered by a trigger character specified by
// the `triggerCharacters` properties of the `CompletionRegistrationOptions`.
TriggerCharacter = 2
};
MAKE_REFLECT_TYPE_PROXY(lsCompletionTriggerKind);
// Contains additional information about the context in which a completion
// request is triggered.
struct lsCompletionContext {
// How the completion was triggered.
lsCompletionTriggerKind triggerKind = lsCompletionTriggerKind::Invoked;
// The trigger character (a single character) that has trigger code complete.
// Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter`
boost::optional<std::string> triggerCharacter;
MAKE_SWAP_METHOD(lsCompletionContext, triggerKind, triggerCharacter);
};
MAKE_REFLECT_STRUCT(lsCompletionContext, triggerKind, triggerCharacter);
struct lsCompletionParams : lsTextDocumentPositionParams {
// The completion context. This is only available it the client specifies to
// send this using
// `ClientCapabilities.textDocument.completion.contextSupport === true`
boost::optional<lsCompletionContext> context;
MAKE_SWAP_METHOD(lsCompletionParams, textDocument, position, context);
};
MAKE_REFLECT_STRUCT(lsCompletionParams, textDocument, position, context);
namespace TextDocumentComplete{
typedef std::pair< boost::optional<std::vector<lsCompletionItem>>, boost::optional<CompletionList> > Either;
};
extern void Reflect(Reader& visitor, TextDocumentComplete::Either& value);
/**
* The Completion request is sent from the client to the server to compute
* completion items at a given cursor position. Completion items are
* presented in the IntelliSense user interface. If computing complete
* completion items is expensive servers can additional provide a handler
* for the resolve completion item request. This request is sent when a
* completion item is selected in the user interface.
*
* Registration Options: CompletionRegistrationOptions
*/
DEFINE_REQUEST_RESPONSE_TYPE(td_completion, lsCompletionParams, CompletionList , "textDocument/completion")
|