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