1syntax = "proto3";
2package zed.messages;
3
4message Envelope {
5 uint32 id = 1;
6 optional uint32 responding_to = 2;
7 optional uint32 original_sender_id = 3;
8 oneof payload {
9 Ack ack = 4;
10 Error error = 5;
11 Ping ping = 6;
12 Test test = 7;
13
14 RegisterProject register_project = 8;
15 RegisterProjectResponse register_project_response = 9;
16 UnregisterProject unregister_project = 10;
17 ShareProject share_project = 11;
18 UnshareProject unshare_project = 12;
19 JoinProject join_project = 13;
20 JoinProjectResponse join_project_response = 14;
21 LeaveProject leave_project = 15;
22 AddProjectCollaborator add_project_collaborator = 16;
23 RemoveProjectCollaborator remove_project_collaborator = 17;
24
25 GetDefinition get_definition = 18;
26 GetDefinitionResponse get_definition_response = 19;
27 GetReferences get_references = 20;
28 GetReferencesResponse get_references_response = 21;
29 GetDocumentHighlights get_document_highlights = 22;
30 GetDocumentHighlightsResponse get_document_highlights_response = 23;
31 GetProjectSymbols get_project_symbols = 24;
32 GetProjectSymbolsResponse get_project_symbols_response = 25;
33 OpenBufferForSymbol open_buffer_for_symbol = 26;
34 OpenBufferForSymbolResponse open_buffer_for_symbol_response = 27;
35
36 RegisterWorktree register_worktree = 28;
37 UnregisterWorktree unregister_worktree = 29;
38 UpdateWorktree update_worktree = 31;
39 UpdateDiagnosticSummary update_diagnostic_summary = 32;
40 StartLanguageServer start_language_server = 33;
41 UpdateLanguageServer update_language_server = 34;
42
43 OpenBufferById open_buffer_by_id = 35;
44 OpenBufferByPath open_buffer_by_path = 36;
45 OpenBufferResponse open_buffer_response = 37;
46 UpdateBuffer update_buffer = 38;
47 UpdateBufferFile update_buffer_file = 39;
48 SaveBuffer save_buffer = 40;
49 BufferSaved buffer_saved = 41;
50 BufferReloaded buffer_reloaded = 42;
51 ReloadBuffers reload_buffers = 43;
52 ReloadBuffersResponse reload_buffers_response = 44;
53 FormatBuffers format_buffers = 45;
54 FormatBuffersResponse format_buffers_response = 46;
55 GetCompletions get_completions = 47;
56 GetCompletionsResponse get_completions_response = 48;
57 ApplyCompletionAdditionalEdits apply_completion_additional_edits = 49;
58 ApplyCompletionAdditionalEditsResponse apply_completion_additional_edits_response = 50;
59 GetCodeActions get_code_actions = 51;
60 GetCodeActionsResponse get_code_actions_response = 52;
61 ApplyCodeAction apply_code_action = 53;
62 ApplyCodeActionResponse apply_code_action_response = 54;
63 PrepareRename prepare_rename = 55;
64 PrepareRenameResponse prepare_rename_response = 56;
65 PerformRename perform_rename = 57;
66 PerformRenameResponse perform_rename_response = 58;
67 SearchProject search_project = 59;
68 SearchProjectResponse search_project_response = 60;
69
70 GetChannels get_channels = 61;
71 GetChannelsResponse get_channels_response = 62;
72 JoinChannel join_channel = 63;
73 JoinChannelResponse join_channel_response = 64;
74 LeaveChannel leave_channel = 65;
75 SendChannelMessage send_channel_message = 66;
76 SendChannelMessageResponse send_channel_message_response = 67;
77 ChannelMessageSent channel_message_sent = 68;
78 GetChannelMessages get_channel_messages = 69;
79 GetChannelMessagesResponse get_channel_messages_response = 70;
80
81 UpdateContacts update_contacts = 71;
82
83 GetUsers get_users = 72;
84 GetUsersResponse get_users_response = 73;
85
86 Follow follow = 74;
87 FollowResponse follow_response = 75;
88 UpdateFollowers update_followers = 76;
89 Unfollow unfollow = 77;
90 }
91}
92
93// Messages
94
95message Ping {}
96
97message Ack {}
98
99message Error {
100 string message = 1;
101}
102
103message Test {
104 uint64 id = 1;
105}
106
107message RegisterProject {}
108
109message RegisterProjectResponse {
110 uint64 project_id = 1;
111}
112
113message UnregisterProject {
114 uint64 project_id = 1;
115}
116
117message ShareProject {
118 uint64 project_id = 1;
119}
120
121message UnshareProject {
122 uint64 project_id = 1;
123}
124
125message JoinProject {
126 uint64 project_id = 1;
127}
128
129message JoinProjectResponse {
130 uint32 replica_id = 1;
131 repeated Worktree worktrees = 2;
132 repeated Collaborator collaborators = 3;
133 repeated LanguageServer language_servers = 4;
134}
135
136message LeaveProject {
137 uint64 project_id = 1;
138}
139
140message RegisterWorktree {
141 uint64 project_id = 1;
142 uint64 worktree_id = 2;
143 string root_name = 3;
144 repeated string authorized_logins = 4;
145 bool visible = 5;
146}
147
148message UnregisterWorktree {
149 uint64 project_id = 1;
150 uint64 worktree_id = 2;
151}
152
153message UpdateWorktree {
154 uint64 project_id = 1;
155 uint64 worktree_id = 2;
156 string root_name = 3;
157 repeated Entry updated_entries = 4;
158 repeated uint64 removed_entries = 5;
159}
160
161message AddProjectCollaborator {
162 uint64 project_id = 1;
163 Collaborator collaborator = 2;
164}
165
166message RemoveProjectCollaborator {
167 uint64 project_id = 1;
168 uint32 peer_id = 2;
169}
170
171message GetDefinition {
172 uint64 project_id = 1;
173 uint64 buffer_id = 2;
174 Anchor position = 3;
175 repeated VectorClockEntry version = 4;
176 }
177
178message GetDefinitionResponse {
179 repeated Location locations = 1;
180}
181
182message GetReferences {
183 uint64 project_id = 1;
184 uint64 buffer_id = 2;
185 Anchor position = 3;
186 repeated VectorClockEntry version = 4;
187 }
188
189message GetReferencesResponse {
190 repeated Location locations = 1;
191}
192
193message GetDocumentHighlights {
194 uint64 project_id = 1;
195 uint64 buffer_id = 2;
196 Anchor position = 3;
197 repeated VectorClockEntry version = 4;
198 }
199
200message GetDocumentHighlightsResponse {
201 repeated DocumentHighlight highlights = 1;
202}
203
204message Location {
205 Buffer buffer = 1;
206 Anchor start = 2;
207 Anchor end = 3;
208}
209
210message DocumentHighlight {
211 Kind kind = 1;
212 Anchor start = 2;
213 Anchor end = 3;
214
215 enum Kind {
216 Text = 0;
217 Read = 1;
218 Write = 2;
219 }
220}
221
222message GetProjectSymbols {
223 uint64 project_id = 1;
224 string query = 2;
225}
226
227message GetProjectSymbolsResponse {
228 repeated Symbol symbols = 4;
229}
230
231message Symbol {
232 uint64 source_worktree_id = 1;
233 uint64 worktree_id = 2;
234 string language_server_name = 3;
235 string name = 4;
236 int32 kind = 5;
237 string path = 6;
238 Point start = 7;
239 Point end = 8;
240 bytes signature = 9;
241}
242
243message OpenBufferForSymbol {
244 uint64 project_id = 1;
245 Symbol symbol = 2;
246}
247
248message OpenBufferForSymbolResponse {
249 Buffer buffer = 1;
250}
251
252message OpenBufferByPath {
253 uint64 project_id = 1;
254 uint64 worktree_id = 2;
255 string path = 3;
256}
257
258message OpenBufferById {
259 uint64 project_id = 1;
260 uint64 id = 2;
261}
262
263message OpenBufferResponse {
264 Buffer buffer = 1;
265}
266
267message CloseBuffer {
268 uint64 project_id = 1;
269 uint64 buffer_id = 2;
270}
271
272message UpdateBuffer {
273 uint64 project_id = 1;
274 uint64 buffer_id = 2;
275 repeated Operation operations = 3;
276}
277
278message UpdateBufferFile {
279 uint64 project_id = 1;
280 uint64 buffer_id = 2;
281 File file = 3;
282}
283
284message SaveBuffer {
285 uint64 project_id = 1;
286 uint64 buffer_id = 2;
287 repeated VectorClockEntry version = 3;
288}
289
290message BufferSaved {
291 uint64 project_id = 1;
292 uint64 buffer_id = 2;
293 repeated VectorClockEntry version = 3;
294 Timestamp mtime = 4;
295}
296
297message BufferReloaded {
298 uint64 project_id = 1;
299 uint64 buffer_id = 2;
300 repeated VectorClockEntry version = 3;
301 Timestamp mtime = 4;
302}
303
304message ReloadBuffers {
305 uint64 project_id = 1;
306 repeated uint64 buffer_ids = 2;
307}
308
309message ReloadBuffersResponse {
310 ProjectTransaction transaction = 1;
311}
312
313message FormatBuffers {
314 uint64 project_id = 1;
315 repeated uint64 buffer_ids = 2;
316}
317
318message FormatBuffersResponse {
319 ProjectTransaction transaction = 1;
320}
321
322message GetCompletions {
323 uint64 project_id = 1;
324 uint64 buffer_id = 2;
325 Anchor position = 3;
326 repeated VectorClockEntry version = 4;
327}
328
329message GetCompletionsResponse {
330 repeated Completion completions = 1;
331 repeated VectorClockEntry version = 2;
332}
333
334message ApplyCompletionAdditionalEdits {
335 uint64 project_id = 1;
336 uint64 buffer_id = 2;
337 Completion completion = 3;
338}
339
340message ApplyCompletionAdditionalEditsResponse {
341 Transaction transaction = 1;
342}
343
344message Completion {
345 Anchor old_start = 1;
346 Anchor old_end = 2;
347 string new_text = 3;
348 bytes lsp_completion = 4;
349}
350
351message GetCodeActions {
352 uint64 project_id = 1;
353 uint64 buffer_id = 2;
354 Anchor start = 3;
355 Anchor end = 4;
356 repeated VectorClockEntry version = 5;
357}
358
359message GetCodeActionsResponse {
360 repeated CodeAction actions = 1;
361 repeated VectorClockEntry version = 2;
362}
363
364message ApplyCodeAction {
365 uint64 project_id = 1;
366 uint64 buffer_id = 2;
367 CodeAction action = 3;
368}
369
370message ApplyCodeActionResponse {
371 ProjectTransaction transaction = 1;
372}
373
374message PrepareRename {
375 uint64 project_id = 1;
376 uint64 buffer_id = 2;
377 Anchor position = 3;
378 repeated VectorClockEntry version = 4;
379}
380
381message PrepareRenameResponse {
382 bool can_rename = 1;
383 Anchor start = 2;
384 Anchor end = 3;
385 repeated VectorClockEntry version = 4;
386}
387
388message PerformRename {
389 uint64 project_id = 1;
390 uint64 buffer_id = 2;
391 Anchor position = 3;
392 string new_name = 4;
393 repeated VectorClockEntry version = 5;
394}
395
396message PerformRenameResponse {
397 ProjectTransaction transaction = 2;
398}
399
400message SearchProject {
401 uint64 project_id = 1;
402 string query = 2;
403 bool regex = 3;
404 bool whole_word = 4;
405 bool case_sensitive = 5;
406}
407
408message SearchProjectResponse {
409 repeated Location locations = 1;
410}
411
412message CodeAction {
413 Anchor start = 1;
414 Anchor end = 2;
415 bytes lsp_action = 3;
416}
417
418message ProjectTransaction {
419 repeated Buffer buffers = 1;
420 repeated Transaction transactions = 2;
421}
422
423message Transaction {
424 LocalTimestamp id = 1;
425 repeated LocalTimestamp edit_ids = 2;
426 repeated VectorClockEntry start = 3;
427 repeated VectorClockEntry end = 4;
428 repeated Range ranges = 5;
429}
430
431message LocalTimestamp {
432 uint32 replica_id = 1;
433 uint32 value = 2;
434}
435
436message LanguageServer {
437 uint64 id = 1;
438 string name = 2;
439}
440
441message StartLanguageServer {
442 uint64 project_id = 1;
443 LanguageServer server = 2;
444}
445
446message UpdateDiagnosticSummary {
447 uint64 project_id = 1;
448 uint64 worktree_id = 2;
449 DiagnosticSummary summary = 3;
450}
451
452message DiagnosticSummary {
453 string path = 1;
454 uint32 error_count = 2;
455 uint32 warning_count = 3;
456}
457
458message UpdateLanguageServer {
459 uint64 project_id = 1;
460 uint64 language_server_id = 2;
461 oneof variant {
462 LspWorkStart work_start = 3;
463 LspWorkProgress work_progress = 4;
464 LspWorkEnd work_end = 5;
465 LspDiskBasedDiagnosticsUpdating disk_based_diagnostics_updating = 6;
466 LspDiskBasedDiagnosticsUpdated disk_based_diagnostics_updated = 7;
467 }
468}
469
470message LspWorkStart {
471 string token = 1;
472}
473
474message LspWorkProgress {
475 string token = 1;
476 optional string message = 2;
477 optional uint32 percentage = 3;
478}
479
480message LspWorkEnd {
481 string token = 1;
482}
483
484message LspDiskBasedDiagnosticsUpdating {}
485
486message LspDiskBasedDiagnosticsUpdated {}
487
488message GetChannels {}
489
490message GetChannelsResponse {
491 repeated Channel channels = 1;
492}
493
494message JoinChannel {
495 uint64 channel_id = 1;
496}
497
498message JoinChannelResponse {
499 repeated ChannelMessage messages = 1;
500 bool done = 2;
501}
502
503message LeaveChannel {
504 uint64 channel_id = 1;
505}
506
507message GetUsers {
508 repeated uint64 user_ids = 1;
509}
510
511message GetUsersResponse {
512 repeated User users = 1;
513}
514
515message SendChannelMessage {
516 uint64 channel_id = 1;
517 string body = 2;
518 Nonce nonce = 3;
519}
520
521message SendChannelMessageResponse {
522 ChannelMessage message = 1;
523}
524
525message ChannelMessageSent {
526 uint64 channel_id = 1;
527 ChannelMessage message = 2;
528}
529
530message GetChannelMessages {
531 uint64 channel_id = 1;
532 uint64 before_message_id = 2;
533}
534
535message GetChannelMessagesResponse {
536 repeated ChannelMessage messages = 1;
537 bool done = 2;
538}
539
540message UpdateContacts {
541 repeated Contact contacts = 1;
542}
543
544message UpdateDiagnostics {
545 uint32 replica_id = 1;
546 uint32 lamport_timestamp = 2;
547 repeated Diagnostic diagnostics = 3;
548}
549
550message Follow {
551 uint64 project_id = 1;
552 uint32 leader_id = 2;
553}
554
555message FollowResponse {
556 optional uint64 active_view_id = 1;
557 repeated View views = 2;
558}
559
560message UpdateFollowers {
561 uint64 project_id = 1;
562 repeated uint32 follower_ids = 2;
563 oneof variant {
564 UpdateActiveView update_active_view = 3;
565 View create_view = 4;
566 UpdateView update_view = 5;
567 }
568}
569
570message Unfollow {
571 uint64 project_id = 1;
572 uint32 leader_id = 2;
573}
574
575// Entities
576
577message UpdateActiveView {
578 optional uint64 id = 1;
579 optional uint32 leader_id = 2;
580}
581
582message UpdateView {
583 uint64 id = 1;
584 optional uint32 leader_id = 2;
585
586 oneof variant {
587 Editor editor = 3;
588 }
589
590 message Editor {
591 repeated Selection selections = 1;
592 Anchor scroll_top_anchor = 2;
593 float scroll_x = 3;
594 float scroll_y = 4;
595 }
596}
597
598message View {
599 uint64 id = 1;
600 optional uint32 leader_id = 2;
601
602 oneof variant {
603 Editor editor = 3;
604 }
605
606 message Editor {
607 uint64 buffer_id = 1;
608 repeated Selection selections = 2;
609 Anchor scroll_top_anchor = 3;
610 float scroll_x = 4;
611 float scroll_y = 5;
612 }
613}
614
615message Collaborator {
616 uint32 peer_id = 1;
617 uint32 replica_id = 2;
618 uint64 user_id = 3;
619}
620
621message User {
622 uint64 id = 1;
623 string github_login = 2;
624 string avatar_url = 3;
625}
626
627message Worktree {
628 uint64 id = 1;
629 string root_name = 2;
630 repeated Entry entries = 3;
631 repeated DiagnosticSummary diagnostic_summaries = 4;
632 bool visible = 5;
633}
634
635message File {
636 uint64 worktree_id = 1;
637 optional uint64 entry_id = 2;
638 string path = 3;
639 Timestamp mtime = 4;
640}
641
642message Entry {
643 uint64 id = 1;
644 bool is_dir = 2;
645 string path = 3;
646 uint64 inode = 4;
647 Timestamp mtime = 5;
648 bool is_symlink = 6;
649 bool is_ignored = 7;
650}
651
652message Buffer {
653 oneof variant {
654 uint64 id = 1;
655 BufferState state = 2;
656 }
657}
658
659message BufferState {
660 uint64 id = 1;
661 optional File file = 2;
662 string base_text = 3;
663 repeated Operation operations = 4;
664 repeated SelectionSet selections = 5;
665 repeated Diagnostic diagnostics = 6;
666 uint32 diagnostics_timestamp = 7;
667 repeated string completion_triggers = 8;
668}
669
670message SelectionSet {
671 uint32 replica_id = 1;
672 repeated Selection selections = 2;
673 uint32 lamport_timestamp = 3;
674}
675
676message Selection {
677 uint64 id = 1;
678 Anchor start = 2;
679 Anchor end = 3;
680 bool reversed = 4;
681}
682
683message Anchor {
684 uint32 replica_id = 1;
685 uint32 local_timestamp = 2;
686 uint64 offset = 3;
687 Bias bias = 4;
688}
689
690enum Bias {
691 Left = 0;
692 Right = 1;
693}
694
695message Diagnostic {
696 Anchor start = 1;
697 Anchor end = 2;
698 Severity severity = 3;
699 string message = 4;
700 optional string code = 5;
701 uint64 group_id = 6;
702 bool is_primary = 7;
703 bool is_valid = 8;
704 bool is_disk_based = 9;
705 bool is_unnecessary = 10;
706
707 enum Severity {
708 None = 0;
709 Error = 1;
710 Warning = 2;
711 Information = 3;
712 Hint = 4;
713 }
714}
715
716message Operation {
717 oneof variant {
718 Edit edit = 1;
719 Undo undo = 2;
720 UpdateSelections update_selections = 3;
721 UpdateDiagnostics update_diagnostics = 4;
722 UpdateCompletionTriggers update_completion_triggers = 5;
723 }
724
725 message Edit {
726 uint32 replica_id = 1;
727 uint32 local_timestamp = 2;
728 uint32 lamport_timestamp = 3;
729 repeated VectorClockEntry version = 4;
730 repeated Range ranges = 5;
731 optional string new_text = 6;
732 }
733
734 message Undo {
735 uint32 replica_id = 1;
736 uint32 local_timestamp = 2;
737 uint32 lamport_timestamp = 3;
738 repeated VectorClockEntry version = 4;
739 repeated Range transaction_ranges = 5;
740 repeated VectorClockEntry transaction_version = 6;
741 repeated UndoCount counts = 7;
742 }
743
744 message UpdateSelections {
745 uint32 replica_id = 1;
746 uint32 lamport_timestamp = 2;
747 repeated Selection selections = 3;
748 }
749
750 message UpdateCompletionTriggers {
751 uint32 replica_id = 1;
752 uint32 lamport_timestamp = 2;
753 repeated string triggers = 3;
754 }
755}
756
757message UndoMapEntry {
758 uint32 replica_id = 1;
759 uint32 local_timestamp = 2;
760 repeated UndoCount counts = 3;
761}
762
763message UndoCount {
764 uint32 replica_id = 1;
765 uint32 local_timestamp = 2;
766 uint32 count = 3;
767}
768
769message VectorClockEntry {
770 uint32 replica_id = 1;
771 uint32 timestamp = 2;
772}
773
774message Timestamp {
775 uint64 seconds = 1;
776 uint32 nanos = 2;
777}
778
779message Range {
780 uint64 start = 1;
781 uint64 end = 2;
782}
783
784message Point {
785 uint32 row = 1;
786 uint32 column = 2;
787}
788
789message Nonce {
790 uint64 upper_half = 1;
791 uint64 lower_half = 2;
792}
793
794message Channel {
795 uint64 id = 1;
796 string name = 2;
797}
798
799message ChannelMessage {
800 uint64 id = 1;
801 string body = 2;
802 uint64 timestamp = 3;
803 uint64 sender_id = 4;
804 Nonce nonce = 5;
805}
806
807message Contact {
808 uint64 user_id = 1;
809 repeated ProjectMetadata projects = 2;
810}
811
812message ProjectMetadata {
813 uint64 id = 1;
814 bool is_shared = 2;
815 repeated string worktree_root_names = 3;
816 repeated uint64 guests = 4;
817}