1syntax = "proto3";
2package zed.messages;
3
4import "core.proto";
5import "worktree.proto";
6
7message OpenNewBuffer {
8 uint64 project_id = 1;
9}
10
11message OpenBufferResponse {
12 uint64 buffer_id = 1;
13}
14
15message CreateBufferForPeer {
16 uint64 project_id = 1;
17 PeerId peer_id = 2;
18 oneof variant {
19 BufferState state = 3;
20 BufferChunk chunk = 4;
21 }
22}
23
24message UpdateBuffer {
25 uint64 project_id = 1;
26 uint64 buffer_id = 2;
27 repeated Operation operations = 3;
28}
29
30message OpenBufferByPath {
31 uint64 project_id = 1;
32 uint64 worktree_id = 2;
33 string path = 3;
34}
35
36message OpenBufferById {
37 uint64 project_id = 1;
38 uint64 id = 2;
39}
40
41message UpdateBufferFile {
42 uint64 project_id = 1;
43 uint64 buffer_id = 2;
44 File file = 3;
45}
46
47message SaveBuffer {
48 uint64 project_id = 1;
49 uint64 buffer_id = 2;
50 repeated VectorClockEntry version = 3;
51 optional ProjectPath new_path = 4;
52}
53
54message CloseBuffer {
55 uint64 project_id = 1;
56 uint64 buffer_id = 2;
57}
58
59message BufferSaved {
60 uint64 project_id = 1;
61 uint64 buffer_id = 2;
62 repeated VectorClockEntry version = 3;
63 Timestamp mtime = 4;
64 reserved 5;
65}
66
67message BufferReloaded {
68 uint64 project_id = 1;
69 uint64 buffer_id = 2;
70 repeated VectorClockEntry version = 3;
71 Timestamp mtime = 4;
72 reserved 5;
73 LineEnding line_ending = 6;
74}
75
76message ReloadBuffers {
77 uint64 project_id = 1;
78 repeated uint64 buffer_ids = 2;
79}
80
81message ReloadBuffersResponse {
82 ProjectTransaction transaction = 1;
83}
84
85message SynchronizeBuffers {
86 uint64 project_id = 1;
87 repeated BufferVersion buffers = 2;
88}
89
90message SynchronizeBuffersResponse {
91 repeated BufferVersion buffers = 1;
92}
93
94message BufferVersion {
95 uint64 id = 1;
96 repeated VectorClockEntry version = 2;
97}
98
99message BufferState {
100 uint64 id = 1;
101 optional File file = 2;
102 string base_text = 3;
103 LineEnding line_ending = 5;
104 repeated VectorClockEntry saved_version = 6;
105 Timestamp saved_mtime = 8;
106
107 reserved 7;
108 reserved 4;
109}
110
111message BufferChunk {
112 uint64 buffer_id = 1;
113 repeated Operation operations = 2;
114 bool is_last = 3;
115}
116
117enum LineEnding {
118 Unix = 0;
119 Windows = 1;
120}
121
122message VectorClockEntry {
123 uint32 replica_id = 1;
124 uint32 timestamp = 2;
125}
126
127message UndoMapEntry {
128 uint32 replica_id = 1;
129 uint32 local_timestamp = 2;
130 repeated UndoCount counts = 3;
131}
132
133message UndoCount {
134 uint32 replica_id = 1;
135 uint32 lamport_timestamp = 2;
136 uint32 count = 3;
137}
138
139message Operation {
140 oneof variant {
141 Edit edit = 1;
142 Undo undo = 2;
143 UpdateSelections update_selections = 3;
144 UpdateDiagnostics update_diagnostics = 4;
145 UpdateCompletionTriggers update_completion_triggers = 5;
146 }
147
148 message Edit {
149 uint32 replica_id = 1;
150 uint32 lamport_timestamp = 2;
151 repeated VectorClockEntry version = 3;
152 repeated Range ranges = 4;
153 repeated string new_text = 5;
154 }
155
156 message Undo {
157 uint32 replica_id = 1;
158 uint32 lamport_timestamp = 2;
159 repeated VectorClockEntry version = 3;
160 repeated UndoCount counts = 4;
161 }
162
163 message UpdateSelections {
164 uint32 replica_id = 1;
165 uint32 lamport_timestamp = 2;
166 repeated Selection selections = 3;
167 bool line_mode = 4;
168 CursorShape cursor_shape = 5;
169 }
170
171 message UpdateCompletionTriggers {
172 uint32 replica_id = 1;
173 uint32 lamport_timestamp = 2;
174 repeated string triggers = 3;
175 uint64 language_server_id = 4;
176 }
177}
178
179message ProjectTransaction {
180 repeated uint64 buffer_ids = 1;
181 repeated Transaction transactions = 2;
182}
183
184message Transaction {
185 LamportTimestamp id = 1;
186 repeated LamportTimestamp edit_ids = 2;
187 repeated VectorClockEntry start = 3;
188}
189
190message LamportTimestamp {
191 uint32 replica_id = 1;
192 uint32 value = 2;
193}
194
195message Range {
196 uint64 start = 1;
197 uint64 end = 2;
198}
199
200message Selection {
201 uint64 id = 1;
202 EditorAnchor start = 2;
203 EditorAnchor end = 3;
204 bool reversed = 4;
205}
206
207message EditorAnchor {
208 uint64 excerpt_id = 1;
209 Anchor anchor = 2;
210}
211
212enum CursorShape {
213 CursorBar = 0;
214 CursorBlock = 1;
215 CursorUnderscore = 2;
216 CursorHollow = 3;
217}
218
219message UpdateDiagnostics {
220 uint32 replica_id = 1;
221 uint32 lamport_timestamp = 2;
222 uint64 server_id = 3;
223 repeated Diagnostic diagnostics = 4;
224}
225
226message Anchor {
227 uint32 replica_id = 1;
228 uint32 timestamp = 2;
229 uint64 offset = 3;
230 Bias bias = 4;
231 optional uint64 buffer_id = 5;
232}
233
234message AnchorRange {
235 Anchor start = 1;
236 Anchor end = 2;
237}
238
239message Location {
240 uint64 buffer_id = 1;
241 Anchor start = 2;
242 Anchor end = 3;
243}
244
245enum Bias {
246 Left = 0;
247 Right = 1;
248}
249
250message Diagnostic {
251 Anchor start = 1;
252 Anchor end = 2;
253 optional string source = 3;
254
255 enum SourceKind {
256 Pulled = 0;
257 Pushed = 1;
258 Other = 2;
259 }
260
261 SourceKind source_kind = 16;
262 Severity severity = 4;
263 string message = 5;
264 optional string code = 6;
265 uint64 group_id = 7;
266 bool is_primary = 8;
267
268 reserved 9;
269
270 bool is_disk_based = 10;
271 bool is_unnecessary = 11;
272 bool underline = 15;
273
274 enum Severity {
275 None = 0;
276 Error = 1;
277 Warning = 2;
278 Information = 3;
279 Hint = 4;
280 }
281 optional string data = 12;
282 optional string code_description = 13;
283 optional string markdown = 14;
284}
285
286message SearchQuery {
287 string query = 2;
288 bool regex = 3;
289 bool whole_word = 4;
290 bool case_sensitive = 5;
291 repeated string files_to_include = 10;
292 repeated string files_to_exclude = 11;
293 bool match_full_paths = 9;
294 bool include_ignored = 8;
295 string files_to_include_legacy = 6;
296 string files_to_exclude_legacy = 7;
297}
298
299message FindSearchCandidates {
300 uint64 project_id = 1;
301 SearchQuery query = 2;
302 uint64 limit = 3;
303}
304
305message FindSearchCandidatesResponse {
306 repeated uint64 buffer_ids = 1;
307}