buffer.proto

  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        UpdateLineEnding update_line_ending = 6;
147    }
148
149    message Edit {
150        uint32 replica_id = 1;
151        uint32 lamport_timestamp = 2;
152        repeated VectorClockEntry version = 3;
153        repeated Range ranges = 4;
154        repeated string new_text = 5;
155    }
156
157    message Undo {
158        uint32 replica_id = 1;
159        uint32 lamport_timestamp = 2;
160        repeated VectorClockEntry version = 3;
161        repeated UndoCount counts = 4;
162    }
163
164    message UpdateSelections {
165        uint32 replica_id = 1;
166        uint32 lamport_timestamp = 2;
167        repeated Selection selections = 3;
168        bool line_mode = 4;
169        CursorShape cursor_shape = 5;
170    }
171
172    message UpdateCompletionTriggers {
173        uint32 replica_id = 1;
174        uint32 lamport_timestamp = 2;
175        repeated string triggers = 3;
176        uint64 language_server_id = 4;
177    }
178
179    message UpdateLineEnding {
180        uint32 replica_id = 1;
181        uint32 lamport_timestamp = 2;
182        LineEnding line_ending = 3;
183    }
184}
185
186message ProjectTransaction {
187    repeated uint64 buffer_ids = 1;
188    repeated Transaction transactions = 2;
189}
190
191message Transaction {
192    LamportTimestamp id = 1;
193    repeated LamportTimestamp edit_ids = 2;
194    repeated VectorClockEntry start = 3;
195}
196
197message LamportTimestamp {
198    uint32 replica_id = 1;
199    uint32 value = 2;
200}
201
202message Range {
203    uint64 start = 1;
204    uint64 end = 2;
205}
206
207message Selection {
208    uint64 id = 1;
209    EditorAnchor start = 2;
210    EditorAnchor end = 3;
211    bool reversed = 4;
212}
213
214message EditorAnchor {
215    uint64 excerpt_id = 1;
216    Anchor anchor = 2;
217}
218
219enum CursorShape {
220    CursorBar = 0;
221    CursorBlock = 1;
222    CursorUnderscore = 2;
223    CursorHollow = 3;
224}
225
226message UpdateDiagnostics {
227    uint32 replica_id = 1;
228    uint32 lamport_timestamp = 2;
229    uint64 server_id = 3;
230    repeated Diagnostic diagnostics = 4;
231}
232
233message Anchor {
234    uint32 replica_id = 1;
235    uint32 timestamp = 2;
236    uint64 offset = 3;
237    Bias bias = 4;
238    optional uint64 buffer_id = 5;
239}
240
241message AnchorRange {
242    Anchor start = 1;
243    Anchor end = 2;
244}
245
246message Location {
247    uint64 buffer_id = 1;
248    Anchor start = 2;
249    Anchor end = 3;
250}
251
252enum Bias {
253    Left = 0;
254    Right = 1;
255}
256
257message Diagnostic {
258    Anchor start = 1;
259    Anchor end = 2;
260    optional string source = 3;
261
262    enum SourceKind {
263        Pulled = 0;
264        Pushed = 1;
265        Other = 2;
266    }
267
268    SourceKind source_kind = 16;
269    Severity severity = 4;
270    string message = 5;
271    optional string code = 6;
272    uint64 group_id = 7;
273    bool is_primary = 8;
274
275    reserved 9;
276
277    bool is_disk_based = 10;
278    bool is_unnecessary = 11;
279    bool underline = 15;
280
281    enum Severity {
282        None = 0;
283        Error = 1;
284        Warning = 2;
285        Information = 3;
286        Hint = 4;
287    }
288    optional string data = 12;
289    optional string code_description = 13;
290    optional string markdown = 14;
291}
292
293message SearchQuery {
294    string query = 2;
295    bool regex = 3;
296    bool whole_word = 4;
297    bool case_sensitive = 5;
298    repeated string files_to_include = 10;
299    repeated string files_to_exclude = 11;
300    bool match_full_paths = 9;
301    bool include_ignored = 8;
302    string files_to_include_legacy = 6;
303    string files_to_exclude_legacy = 7;
304}
305
306message FindSearchCandidates {
307    uint64 project_id = 1;
308    SearchQuery query = 2;
309    uint64 limit = 3;
310}
311
312message FindSearchCandidatesResponse {
313    repeated uint64 buffer_ids = 1;
314}