-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathBasic.h
More file actions
139 lines (104 loc) · 2.92 KB
/
Basic.h
File metadata and controls
139 lines (104 loc) · 2.92 KB
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#pragma once
#include <array>
#include <cstdint>
#include <optional>
#include <string>
#include <vector>
#include "llvm/Support/JSON.h"
namespace clice::proto {
using integer = std::int32_t;
/// range in [0, 2^31- 1]
using uinteger = std::uint32_t;
using decimal = double;
using string = std::string;
using any = llvm::json::Value;
template <typename T>
using array = std::vector<T>;
template <typename T>
using optional = std::optional<T>;
using PositionEncodingKind = string;
struct WorkDoneProgressOptions {
bool workDoneProgress;
};
using URI = string;
using DocumentUri = string;
enum class ErrorCodes : integer {
/// Defined by JSON-RPC.
ParseError = -32700,
InvalidRequest = -32600,
MethodNotFound = -32601,
InvalidParams = -32602,
InternalError = -32603,
/// JSON-RPC error code indicating a server error.
serverErrorStart = -32099,
serverErrorEnd = -32000,
ServerNotInitialized = -32002,
UnknownErrorCode = -32001,
/// Defined by the protocol.
RequestFailed = -32803,
ServerCancelled = -32802,
ContentModified = -32801,
RequestCancelled = -32800
};
struct Position {
/// Line position in a document (zero-based).
uinteger line;
/// Character offset on a line in a document (zero-based).
/// The meaning of this offset is determined by the negotiated
/// `PositionEncodingKind`.
uinteger character;
constexpr friend bool operator==(const Position&, const Position&) = default;
};
struct Range {
/// The range's start position.
Position start;
/// The range's end position.
Position end;
constexpr friend bool operator==(const Range&, const Range&) = default;
};
struct Location {
DocumentUri uri;
Range range;
};
struct TextEdit {
/// The range of the text document to be manipulated. To insert
/// text into a document create a range where start === end.
Range range;
// The string to be inserted. For delete operations use an
// empty string.
string newText;
};
struct TextDocumentItem {
/// The text document's URI.
DocumentUri uri;
/// The text document's language identifier.
string languageId;
/// The version number of this document (it will strictly increase after each
/// change, including undo/redo).
uinteger version;
/// The content of the opened text document.
string text;
};
struct TextDocumentIdentifier {
/// The text document's URI.
DocumentUri uri;
};
struct VersionedTextDocumentIdentifier {
/// The text document's URI.
DocumentUri uri;
/// The version of document.
integer version;
};
struct TextDocumentPositionParams {
/// The text document.
TextDocumentIdentifier textDocument;
/// The position inside the text document.
Position position;
};
struct MarkupContent {
/// The type of the Markup.
string kind;
/// The content itself.
string value;
};
} // namespace clice::proto