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