1syntax = "proto3";
2package zed.messages;
3
4message PeerId {
5 uint32 owner_id = 1;
6 uint32 id = 2;
7}
8
9message Envelope {
10 uint32 id = 1;
11 optional uint32 responding_to = 2;
12 optional PeerId original_sender_id = 3;
13 oneof payload {
14 Hello hello = 4;
15 Ack ack = 5;
16 Error error = 6;
17 Ping ping = 7;
18 Test test = 8;
19
20 CreateRoom create_room = 9;
21 CreateRoomResponse create_room_response = 10;
22 JoinRoom join_room = 11;
23 JoinRoomResponse join_room_response = 12;
24 RejoinRoom rejoin_room = 108;
25 RejoinRoomResponse rejoin_room_response = 109;
26 LeaveRoom leave_room = 13;
27 Call call = 14;
28 IncomingCall incoming_call = 15;
29 CallCanceled call_canceled = 16;
30 CancelCall cancel_call = 17;
31 DeclineCall decline_call = 18;
32 UpdateParticipantLocation update_participant_location = 19;
33 RoomUpdated room_updated = 20;
34
35 ShareProject share_project = 21;
36 ShareProjectResponse share_project_response = 22;
37 UnshareProject unshare_project = 23;
38 JoinProject join_project = 24;
39 JoinProjectResponse join_project_response = 25;
40 LeaveProject leave_project = 26;
41 AddProjectCollaborator add_project_collaborator = 27;
42 UpdateProjectCollaborator update_project_collaborator = 110;
43 RemoveProjectCollaborator remove_project_collaborator = 28;
44
45 GetDefinition get_definition = 29;
46 GetDefinitionResponse get_definition_response = 30;
47 GetTypeDefinition get_type_definition = 31;
48 GetTypeDefinitionResponse get_type_definition_response = 32;
49 GetReferences get_references = 33;
50 GetReferencesResponse get_references_response = 34;
51 GetDocumentHighlights get_document_highlights = 35;
52 GetDocumentHighlightsResponse get_document_highlights_response = 36;
53 GetProjectSymbols get_project_symbols = 37;
54 GetProjectSymbolsResponse get_project_symbols_response = 38;
55 OpenBufferForSymbol open_buffer_for_symbol = 39;
56 OpenBufferForSymbolResponse open_buffer_for_symbol_response = 40;
57
58 UpdateProject update_project = 41;
59 UpdateWorktree update_worktree = 43;
60
61 CreateProjectEntry create_project_entry = 45;
62 RenameProjectEntry rename_project_entry = 46;
63 CopyProjectEntry copy_project_entry = 47;
64 DeleteProjectEntry delete_project_entry = 48;
65 ProjectEntryResponse project_entry_response = 49;
66
67 UpdateDiagnosticSummary update_diagnostic_summary = 50;
68 StartLanguageServer start_language_server = 51;
69 UpdateLanguageServer update_language_server = 52;
70
71 OpenBufferById open_buffer_by_id = 53;
72 OpenBufferByPath open_buffer_by_path = 54;
73 OpenBufferResponse open_buffer_response = 55;
74 CreateBufferForPeer create_buffer_for_peer = 56;
75 UpdateBuffer update_buffer = 57;
76 UpdateBufferFile update_buffer_file = 58;
77 SaveBuffer save_buffer = 59;
78 BufferSaved buffer_saved = 60;
79 BufferReloaded buffer_reloaded = 61;
80 ReloadBuffers reload_buffers = 62;
81 ReloadBuffersResponse reload_buffers_response = 63;
82 SynchronizeBuffers synchronize_buffers = 200;
83 SynchronizeBuffersResponse synchronize_buffers_response = 201;
84 FormatBuffers format_buffers = 64;
85 FormatBuffersResponse format_buffers_response = 65;
86 GetCompletions get_completions = 66;
87 GetCompletionsResponse get_completions_response = 67;
88 ApplyCompletionAdditionalEdits apply_completion_additional_edits = 68;
89 ApplyCompletionAdditionalEditsResponse apply_completion_additional_edits_response = 69;
90 GetCodeActions get_code_actions = 70;
91 GetCodeActionsResponse get_code_actions_response = 71;
92 GetHover get_hover = 72;
93 GetHoverResponse get_hover_response = 73;
94 ApplyCodeAction apply_code_action = 74;
95 ApplyCodeActionResponse apply_code_action_response = 75;
96 PrepareRename prepare_rename = 76;
97 PrepareRenameResponse prepare_rename_response = 77;
98 PerformRename perform_rename = 78;
99 PerformRenameResponse perform_rename_response = 79;
100 SearchProject search_project = 80;
101 SearchProjectResponse search_project_response = 81;
102
103 GetChannels get_channels = 82;
104 GetChannelsResponse get_channels_response = 83;
105 JoinChannel join_channel = 84;
106 JoinChannelResponse join_channel_response = 85;
107 LeaveChannel leave_channel = 86;
108 SendChannelMessage send_channel_message = 87;
109 SendChannelMessageResponse send_channel_message_response = 88;
110 ChannelMessageSent channel_message_sent = 89;
111 GetChannelMessages get_channel_messages = 90;
112 GetChannelMessagesResponse get_channel_messages_response = 91;
113
114 UpdateContacts update_contacts = 92;
115 UpdateInviteInfo update_invite_info = 93;
116 ShowContacts show_contacts = 94;
117
118 GetUsers get_users = 95;
119 FuzzySearchUsers fuzzy_search_users = 96;
120 UsersResponse users_response = 97;
121 RequestContact request_contact = 98;
122 RespondToContactRequest respond_to_contact_request = 99;
123 RemoveContact remove_contact = 100;
124
125 Follow follow = 101;
126 FollowResponse follow_response = 102;
127 UpdateFollowers update_followers = 103;
128 Unfollow unfollow = 104;
129 GetPrivateUserInfo get_private_user_info = 105;
130 GetPrivateUserInfoResponse get_private_user_info_response = 106;
131 UpdateDiffBase update_diff_base = 107;
132 }
133}
134
135// Messages
136
137message Hello {
138 PeerId peer_id = 1;
139}
140
141message Ping {}
142
143message Ack {}
144
145message Error {
146 string message = 1;
147}
148
149message Test {
150 uint64 id = 1;
151}
152
153message CreateRoom {}
154
155message CreateRoomResponse {
156 Room room = 1;
157 optional LiveKitConnectionInfo live_kit_connection_info = 2;
158}
159
160message JoinRoom {
161 uint64 id = 1;
162}
163
164message JoinRoomResponse {
165 Room room = 1;
166 optional LiveKitConnectionInfo live_kit_connection_info = 2;
167}
168
169message RejoinRoom {
170 uint64 id = 1;
171 repeated UpdateProject reshared_projects = 2;
172 repeated RejoinProject rejoined_projects = 3;
173}
174
175message RejoinProject {
176 uint64 id = 1;
177 repeated RejoinWorktree worktrees = 2;
178}
179
180message RejoinWorktree {
181 uint64 id = 1;
182 uint64 scan_id = 2;
183}
184
185message RejoinRoomResponse {
186 Room room = 1;
187 repeated ResharedProject reshared_projects = 2;
188 repeated RejoinedProject rejoined_projects = 3;
189}
190
191message ResharedProject {
192 uint64 id = 1;
193 repeated Collaborator collaborators = 2;
194}
195
196message RejoinedProject {
197 uint64 id = 1;
198 repeated WorktreeMetadata worktrees = 2;
199 repeated Collaborator collaborators = 3;
200 repeated LanguageServer language_servers = 4;
201}
202
203message LeaveRoom {}
204
205message Room {
206 uint64 id = 1;
207 repeated Participant participants = 2;
208 repeated PendingParticipant pending_participants = 3;
209 string live_kit_room = 4;
210}
211
212message Participant {
213 uint64 user_id = 1;
214 PeerId peer_id = 2;
215 repeated ParticipantProject projects = 3;
216 ParticipantLocation location = 4;
217}
218
219message PendingParticipant {
220 uint64 user_id = 1;
221 uint64 calling_user_id = 2;
222 optional uint64 initial_project_id = 3;
223}
224
225message ParticipantProject {
226 uint64 id = 1;
227 repeated string worktree_root_names = 2;
228}
229
230message ParticipantLocation {
231 oneof variant {
232 SharedProject shared_project = 1;
233 UnsharedProject unshared_project = 2;
234 External external = 3;
235 }
236
237 message SharedProject {
238 uint64 id = 1;
239 }
240
241 message UnsharedProject {}
242
243 message External {}
244}
245
246message Call {
247 uint64 room_id = 1;
248 uint64 called_user_id = 2;
249 optional uint64 initial_project_id = 3;
250}
251
252message IncomingCall {
253 uint64 room_id = 1;
254 uint64 calling_user_id = 2;
255 repeated uint64 participant_user_ids = 3;
256 optional ParticipantProject initial_project = 4;
257}
258
259message CallCanceled {
260 uint64 room_id = 1;
261}
262
263message CancelCall {
264 uint64 room_id = 1;
265 uint64 called_user_id = 2;
266}
267
268message DeclineCall {
269 uint64 room_id = 1;
270}
271
272message UpdateParticipantLocation {
273 uint64 room_id = 1;
274 ParticipantLocation location = 2;
275}
276
277message RoomUpdated {
278 Room room = 1;
279}
280
281message LiveKitConnectionInfo {
282 string server_url = 1;
283 string token = 2;
284}
285
286message ShareProject {
287 uint64 room_id = 1;
288 repeated WorktreeMetadata worktrees = 2;
289}
290
291message ShareProjectResponse {
292 uint64 project_id = 1;
293}
294
295message UnshareProject {
296 uint64 project_id = 1;
297}
298
299message UpdateProject {
300 uint64 project_id = 1;
301 repeated WorktreeMetadata worktrees = 2;
302}
303
304message JoinProject {
305 uint64 project_id = 1;
306}
307
308message JoinProjectResponse {
309 uint32 replica_id = 1;
310 repeated WorktreeMetadata worktrees = 2;
311 repeated Collaborator collaborators = 3;
312 repeated LanguageServer language_servers = 4;
313}
314
315message LeaveProject {
316 uint64 project_id = 1;
317}
318
319message UpdateWorktree {
320 uint64 project_id = 1;
321 uint64 worktree_id = 2;
322 string root_name = 3;
323 repeated Entry updated_entries = 4;
324 repeated uint64 removed_entries = 5;
325 uint64 scan_id = 6;
326 bool is_last_update = 7;
327 string abs_path = 8;
328}
329
330message CreateProjectEntry {
331 uint64 project_id = 1;
332 uint64 worktree_id = 2;
333 string path = 3;
334 bool is_directory = 4;
335}
336
337message RenameProjectEntry {
338 uint64 project_id = 1;
339 uint64 entry_id = 2;
340 string new_path = 3;
341}
342
343message CopyProjectEntry {
344 uint64 project_id = 1;
345 uint64 entry_id = 2;
346 string new_path = 3;
347}
348
349message DeleteProjectEntry {
350 uint64 project_id = 1;
351 uint64 entry_id = 2;
352}
353
354message ProjectEntryResponse {
355 Entry entry = 1;
356 uint64 worktree_scan_id = 2;
357}
358
359message AddProjectCollaborator {
360 uint64 project_id = 1;
361 Collaborator collaborator = 2;
362}
363
364message UpdateProjectCollaborator {
365 uint64 project_id = 1;
366 PeerId old_peer_id = 2;
367 PeerId new_peer_id = 3;
368}
369
370message RemoveProjectCollaborator {
371 uint64 project_id = 1;
372 PeerId peer_id = 2;
373}
374
375message GetDefinition {
376 uint64 project_id = 1;
377 uint64 buffer_id = 2;
378 Anchor position = 3;
379 repeated VectorClockEntry version = 4;
380 }
381
382message GetDefinitionResponse {
383 repeated LocationLink links = 1;
384}
385
386message GetTypeDefinition {
387 uint64 project_id = 1;
388 uint64 buffer_id = 2;
389 Anchor position = 3;
390 repeated VectorClockEntry version = 4;
391 }
392
393message GetTypeDefinitionResponse {
394 repeated LocationLink links = 1;
395}
396
397message GetReferences {
398 uint64 project_id = 1;
399 uint64 buffer_id = 2;
400 Anchor position = 3;
401 repeated VectorClockEntry version = 4;
402 }
403
404message GetReferencesResponse {
405 repeated Location locations = 1;
406}
407
408message GetDocumentHighlights {
409 uint64 project_id = 1;
410 uint64 buffer_id = 2;
411 Anchor position = 3;
412 repeated VectorClockEntry version = 4;
413 }
414
415message GetDocumentHighlightsResponse {
416 repeated DocumentHighlight highlights = 1;
417}
418
419message Location {
420 uint64 buffer_id = 1;
421 Anchor start = 2;
422 Anchor end = 3;
423}
424
425message LocationLink {
426 optional Location origin = 1;
427 Location target = 2;
428}
429
430message DocumentHighlight {
431 Kind kind = 1;
432 Anchor start = 2;
433 Anchor end = 3;
434
435 enum Kind {
436 Text = 0;
437 Read = 1;
438 Write = 2;
439 }
440}
441
442message GetProjectSymbols {
443 uint64 project_id = 1;
444 string query = 2;
445}
446
447message GetProjectSymbolsResponse {
448 repeated Symbol symbols = 4;
449}
450
451message Symbol {
452 uint64 source_worktree_id = 1;
453 uint64 worktree_id = 2;
454 string language_server_name = 3;
455 string name = 4;
456 int32 kind = 5;
457 string path = 6;
458 // Cannot use generate anchors for unopend files,
459 // so we are forced to use point coords instead
460 PointUtf16 start = 7;
461 PointUtf16 end = 8;
462 bytes signature = 9;
463}
464
465message OpenBufferForSymbol {
466 uint64 project_id = 1;
467 Symbol symbol = 2;
468}
469
470message OpenBufferForSymbolResponse {
471 uint64 buffer_id = 1;
472}
473
474message OpenBufferByPath {
475 uint64 project_id = 1;
476 uint64 worktree_id = 2;
477 string path = 3;
478}
479
480message OpenBufferById {
481 uint64 project_id = 1;
482 uint64 id = 2;
483}
484
485message OpenBufferResponse {
486 uint64 buffer_id = 1;
487}
488
489message CreateBufferForPeer {
490 uint64 project_id = 1;
491 PeerId peer_id = 2;
492 oneof variant {
493 BufferState state = 3;
494 BufferChunk chunk = 4;
495 }
496}
497
498message UpdateBuffer {
499 uint64 project_id = 1;
500 uint64 buffer_id = 2;
501 repeated Operation operations = 3;
502}
503
504message UpdateBufferFile {
505 uint64 project_id = 1;
506 uint64 buffer_id = 2;
507 File file = 3;
508}
509
510message SaveBuffer {
511 uint64 project_id = 1;
512 uint64 buffer_id = 2;
513 repeated VectorClockEntry version = 3;
514}
515
516message BufferSaved {
517 uint64 project_id = 1;
518 uint64 buffer_id = 2;
519 repeated VectorClockEntry version = 3;
520 Timestamp mtime = 4;
521 string fingerprint = 5;
522}
523
524message BufferReloaded {
525 uint64 project_id = 1;
526 uint64 buffer_id = 2;
527 repeated VectorClockEntry version = 3;
528 Timestamp mtime = 4;
529 string fingerprint = 5;
530 LineEnding line_ending = 6;
531}
532
533message ReloadBuffers {
534 uint64 project_id = 1;
535 repeated uint64 buffer_ids = 2;
536}
537
538message ReloadBuffersResponse {
539 ProjectTransaction transaction = 1;
540}
541
542message SynchronizeBuffers {
543 uint64 project_id = 1;
544 repeated BufferVersion buffers = 2;
545}
546
547message SynchronizeBuffersResponse {
548 repeated BufferVersion buffers = 1;
549}
550
551message BufferVersion {
552 uint64 id = 1;
553 repeated VectorClockEntry version = 2;
554}
555
556enum FormatTrigger {
557 Save = 0;
558 Manual = 1;
559}
560
561message FormatBuffers {
562 uint64 project_id = 1;
563 FormatTrigger trigger = 2;
564 repeated uint64 buffer_ids = 3;
565}
566
567message FormatBuffersResponse {
568 ProjectTransaction transaction = 1;
569}
570
571message GetCompletions {
572 uint64 project_id = 1;
573 uint64 buffer_id = 2;
574 Anchor position = 3;
575 repeated VectorClockEntry version = 4;
576}
577
578message GetCompletionsResponse {
579 repeated Completion completions = 1;
580 repeated VectorClockEntry version = 2;
581}
582
583message ApplyCompletionAdditionalEdits {
584 uint64 project_id = 1;
585 uint64 buffer_id = 2;
586 Completion completion = 3;
587}
588
589message ApplyCompletionAdditionalEditsResponse {
590 Transaction transaction = 1;
591}
592
593message Completion {
594 Anchor old_start = 1;
595 Anchor old_end = 2;
596 string new_text = 3;
597 bytes lsp_completion = 4;
598}
599
600message GetCodeActions {
601 uint64 project_id = 1;
602 uint64 buffer_id = 2;
603 Anchor start = 3;
604 Anchor end = 4;
605 repeated VectorClockEntry version = 5;
606}
607
608message GetCodeActionsResponse {
609 repeated CodeAction actions = 1;
610 repeated VectorClockEntry version = 2;
611}
612
613message GetHover {
614 uint64 project_id = 1;
615 uint64 buffer_id = 2;
616 Anchor position = 3;
617 repeated VectorClockEntry version = 5;
618}
619
620message GetHoverResponse {
621 optional Anchor start = 1;
622 optional Anchor end = 2;
623 repeated HoverBlock contents = 3;
624}
625
626message HoverBlock {
627 string text = 1;
628 optional string language = 2;
629}
630
631message ApplyCodeAction {
632 uint64 project_id = 1;
633 uint64 buffer_id = 2;
634 CodeAction action = 3;
635}
636
637message ApplyCodeActionResponse {
638 ProjectTransaction transaction = 1;
639}
640
641message PrepareRename {
642 uint64 project_id = 1;
643 uint64 buffer_id = 2;
644 Anchor position = 3;
645 repeated VectorClockEntry version = 4;
646}
647
648message PrepareRenameResponse {
649 bool can_rename = 1;
650 Anchor start = 2;
651 Anchor end = 3;
652 repeated VectorClockEntry version = 4;
653}
654
655message PerformRename {
656 uint64 project_id = 1;
657 uint64 buffer_id = 2;
658 Anchor position = 3;
659 string new_name = 4;
660 repeated VectorClockEntry version = 5;
661}
662
663message PerformRenameResponse {
664 ProjectTransaction transaction = 2;
665}
666
667message SearchProject {
668 uint64 project_id = 1;
669 string query = 2;
670 bool regex = 3;
671 bool whole_word = 4;
672 bool case_sensitive = 5;
673}
674
675message SearchProjectResponse {
676 repeated Location locations = 1;
677}
678
679message CodeAction {
680 Anchor start = 1;
681 Anchor end = 2;
682 bytes lsp_action = 3;
683}
684
685message ProjectTransaction {
686 repeated uint64 buffer_ids = 1;
687 repeated Transaction transactions = 2;
688}
689
690message Transaction {
691 LocalTimestamp id = 1;
692 repeated LocalTimestamp edit_ids = 2;
693 repeated VectorClockEntry start = 3;
694}
695
696message LocalTimestamp {
697 uint32 replica_id = 1;
698 uint32 value = 2;
699}
700
701message LanguageServer {
702 uint64 id = 1;
703 string name = 2;
704}
705
706message StartLanguageServer {
707 uint64 project_id = 1;
708 LanguageServer server = 2;
709}
710
711message UpdateDiagnosticSummary {
712 uint64 project_id = 1;
713 uint64 worktree_id = 2;
714 DiagnosticSummary summary = 3;
715}
716
717message DiagnosticSummary {
718 string path = 1;
719 uint64 language_server_id = 2;
720 uint32 error_count = 3;
721 uint32 warning_count = 4;
722}
723
724message UpdateLanguageServer {
725 uint64 project_id = 1;
726 uint64 language_server_id = 2;
727 oneof variant {
728 LspWorkStart work_start = 3;
729 LspWorkProgress work_progress = 4;
730 LspWorkEnd work_end = 5;
731 LspDiskBasedDiagnosticsUpdating disk_based_diagnostics_updating = 6;
732 LspDiskBasedDiagnosticsUpdated disk_based_diagnostics_updated = 7;
733 }
734}
735
736message LspWorkStart {
737 string token = 1;
738 optional string message = 2;
739 optional uint32 percentage = 3;
740}
741
742message LspWorkProgress {
743 string token = 1;
744 optional string message = 2;
745 optional uint32 percentage = 3;
746}
747
748message LspWorkEnd {
749 string token = 1;
750}
751
752message LspDiskBasedDiagnosticsUpdating {}
753
754message LspDiskBasedDiagnosticsUpdated {}
755
756message GetChannels {}
757
758message GetChannelsResponse {
759 repeated Channel channels = 1;
760}
761
762message JoinChannel {
763 uint64 channel_id = 1;
764}
765
766message JoinChannelResponse {
767 repeated ChannelMessage messages = 1;
768 bool done = 2;
769}
770
771message LeaveChannel {
772 uint64 channel_id = 1;
773}
774
775message GetUsers {
776 repeated uint64 user_ids = 1;
777}
778
779message FuzzySearchUsers {
780 string query = 1;
781}
782
783message UsersResponse {
784 repeated User users = 1;
785}
786
787message RequestContact {
788 uint64 responder_id = 1;
789}
790
791message RemoveContact {
792 uint64 user_id = 1;
793}
794
795message RespondToContactRequest {
796 uint64 requester_id = 1;
797 ContactRequestResponse response = 2;
798}
799
800enum ContactRequestResponse {
801 Accept = 0;
802 Decline = 1;
803 Block = 2;
804 Dismiss = 3;
805}
806
807message SendChannelMessage {
808 uint64 channel_id = 1;
809 string body = 2;
810 Nonce nonce = 3;
811}
812
813message SendChannelMessageResponse {
814 ChannelMessage message = 1;
815}
816
817message ChannelMessageSent {
818 uint64 channel_id = 1;
819 ChannelMessage message = 2;
820}
821
822message GetChannelMessages {
823 uint64 channel_id = 1;
824 uint64 before_message_id = 2;
825}
826
827message GetChannelMessagesResponse {
828 repeated ChannelMessage messages = 1;
829 bool done = 2;
830}
831
832message UpdateContacts {
833 repeated Contact contacts = 1;
834 repeated uint64 remove_contacts = 2;
835 repeated IncomingContactRequest incoming_requests = 3;
836 repeated uint64 remove_incoming_requests = 4;
837 repeated uint64 outgoing_requests = 5;
838 repeated uint64 remove_outgoing_requests = 6;
839}
840
841message UpdateInviteInfo {
842 string url = 1;
843 uint32 count = 2;
844}
845
846message ShowContacts {}
847
848message IncomingContactRequest {
849 uint64 requester_id = 1;
850 bool should_notify = 2;
851}
852
853message UpdateDiagnostics {
854 uint32 replica_id = 1;
855 uint32 lamport_timestamp = 2;
856 repeated Diagnostic diagnostics = 3;
857}
858
859message Follow {
860 uint64 project_id = 1;
861 PeerId leader_id = 2;
862}
863
864message FollowResponse {
865 optional ViewId active_view_id = 1;
866 repeated View views = 2;
867}
868
869message UpdateFollowers {
870 uint64 project_id = 1;
871 repeated PeerId follower_ids = 2;
872 oneof variant {
873 UpdateActiveView update_active_view = 3;
874 View create_view = 4;
875 UpdateView update_view = 5;
876 }
877}
878
879message Unfollow {
880 uint64 project_id = 1;
881 PeerId leader_id = 2;
882}
883
884message GetPrivateUserInfo {}
885
886message GetPrivateUserInfoResponse {
887 string metrics_id = 1;
888 bool staff = 2;
889}
890
891// Entities
892
893message ViewId {
894 PeerId creator = 1;
895 uint64 id = 2;
896}
897
898message UpdateActiveView {
899 optional ViewId id = 1;
900 optional PeerId leader_id = 2;
901}
902
903message UpdateView {
904 ViewId id = 1;
905 optional PeerId leader_id = 2;
906
907 oneof variant {
908 Editor editor = 3;
909 }
910
911 message Editor {
912 repeated ExcerptInsertion inserted_excerpts = 1;
913 repeated uint64 deleted_excerpts = 2;
914 repeated Selection selections = 3;
915 optional Selection pending_selection = 4;
916 EditorAnchor scroll_top_anchor = 5;
917 float scroll_x = 6;
918 float scroll_y = 7;
919 }
920}
921
922message View {
923 ViewId id = 1;
924 optional PeerId leader_id = 2;
925
926 oneof variant {
927 Editor editor = 3;
928 }
929
930 message Editor {
931 bool singleton = 1;
932 optional string title = 2;
933 repeated Excerpt excerpts = 3;
934 repeated Selection selections = 4;
935 optional Selection pending_selection = 5;
936 EditorAnchor scroll_top_anchor = 6;
937 float scroll_x = 7;
938 float scroll_y = 8;
939 }
940}
941
942message Collaborator {
943 PeerId peer_id = 1;
944 uint32 replica_id = 2;
945 uint64 user_id = 3;
946}
947
948message User {
949 uint64 id = 1;
950 string github_login = 2;
951 string avatar_url = 3;
952}
953
954message File {
955 uint64 worktree_id = 1;
956 uint64 entry_id = 2;
957 string path = 3;
958 Timestamp mtime = 4;
959 bool is_deleted = 5;
960}
961
962message Entry {
963 uint64 id = 1;
964 bool is_dir = 2;
965 string path = 3;
966 uint64 inode = 4;
967 Timestamp mtime = 5;
968 bool is_symlink = 6;
969 bool is_ignored = 7;
970}
971
972message BufferState {
973 uint64 id = 1;
974 optional File file = 2;
975 string base_text = 3;
976 optional string diff_base = 4;
977 LineEnding line_ending = 5;
978}
979
980message BufferChunk {
981 uint64 buffer_id = 1;
982 repeated Operation operations = 2;
983 bool is_last = 3;
984}
985
986enum LineEnding {
987 Unix = 0;
988 Windows = 1;
989}
990
991message Selection {
992 uint64 id = 1;
993 EditorAnchor start = 2;
994 EditorAnchor end = 3;
995 bool reversed = 4;
996}
997
998message EditorAnchor {
999 uint64 excerpt_id = 1;
1000 Anchor anchor = 2;
1001}
1002
1003enum CursorShape {
1004 CursorBar = 0;
1005 CursorBlock = 1;
1006 CursorUnderscore = 2;
1007 CursorHollow = 3;
1008}
1009
1010message ExcerptInsertion {
1011 Excerpt excerpt = 1;
1012 optional uint64 previous_excerpt_id = 2;
1013}
1014
1015message Excerpt {
1016 uint64 id = 1;
1017 uint64 buffer_id = 2;
1018 Anchor context_start = 3;
1019 Anchor context_end = 4;
1020 Anchor primary_start = 5;
1021 Anchor primary_end = 6;
1022}
1023
1024message Anchor {
1025 uint32 replica_id = 1;
1026 uint32 local_timestamp = 2;
1027 uint64 offset = 3;
1028 Bias bias = 4;
1029 optional uint64 buffer_id = 5;
1030}
1031
1032enum Bias {
1033 Left = 0;
1034 Right = 1;
1035}
1036
1037message Diagnostic {
1038 Anchor start = 1;
1039 Anchor end = 2;
1040 Severity severity = 3;
1041 string message = 4;
1042 optional string code = 5;
1043 uint64 group_id = 6;
1044 bool is_primary = 7;
1045 bool is_valid = 8;
1046 bool is_disk_based = 9;
1047 bool is_unnecessary = 10;
1048
1049 enum Severity {
1050 None = 0;
1051 Error = 1;
1052 Warning = 2;
1053 Information = 3;
1054 Hint = 4;
1055 }
1056}
1057
1058message Operation {
1059 oneof variant {
1060 Edit edit = 1;
1061 Undo undo = 2;
1062 UpdateSelections update_selections = 3;
1063 UpdateDiagnostics update_diagnostics = 4;
1064 UpdateCompletionTriggers update_completion_triggers = 5;
1065 }
1066
1067 message Edit {
1068 uint32 replica_id = 1;
1069 uint32 local_timestamp = 2;
1070 uint32 lamport_timestamp = 3;
1071 repeated VectorClockEntry version = 4;
1072 repeated Range ranges = 5;
1073 repeated string new_text = 6;
1074 }
1075
1076 message Undo {
1077 uint32 replica_id = 1;
1078 uint32 local_timestamp = 2;
1079 uint32 lamport_timestamp = 3;
1080 repeated VectorClockEntry version = 4;
1081 repeated UndoCount counts = 5;
1082 }
1083
1084 message UpdateSelections {
1085 uint32 replica_id = 1;
1086 uint32 lamport_timestamp = 2;
1087 repeated Selection selections = 3;
1088 bool line_mode = 4;
1089 CursorShape cursor_shape = 5;
1090 }
1091
1092 message UpdateCompletionTriggers {
1093 uint32 replica_id = 1;
1094 uint32 lamport_timestamp = 2;
1095 repeated string triggers = 3;
1096 }
1097}
1098
1099message UndoMapEntry {
1100 uint32 replica_id = 1;
1101 uint32 local_timestamp = 2;
1102 repeated UndoCount counts = 3;
1103}
1104
1105message UndoCount {
1106 uint32 replica_id = 1;
1107 uint32 local_timestamp = 2;
1108 uint32 count = 3;
1109}
1110
1111message VectorClockEntry {
1112 uint32 replica_id = 1;
1113 uint32 timestamp = 2;
1114}
1115
1116message Timestamp {
1117 uint64 seconds = 1;
1118 uint32 nanos = 2;
1119}
1120
1121message Range {
1122 uint64 start = 1;
1123 uint64 end = 2;
1124}
1125
1126message PointUtf16 {
1127 uint32 row = 1;
1128 uint32 column = 2;
1129}
1130
1131message Nonce {
1132 uint64 upper_half = 1;
1133 uint64 lower_half = 2;
1134}
1135
1136message Channel {
1137 uint64 id = 1;
1138 string name = 2;
1139}
1140
1141message ChannelMessage {
1142 uint64 id = 1;
1143 string body = 2;
1144 uint64 timestamp = 3;
1145 uint64 sender_id = 4;
1146 Nonce nonce = 5;
1147}
1148
1149message Contact {
1150 uint64 user_id = 1;
1151 bool online = 2;
1152 bool busy = 3;
1153 bool should_notify = 4;
1154}
1155
1156message WorktreeMetadata {
1157 uint64 id = 1;
1158 string root_name = 2;
1159 bool visible = 3;
1160 string abs_path = 4;
1161}
1162
1163message UpdateDiffBase {
1164 uint64 project_id = 1;
1165 uint64 buffer_id = 2;
1166 optional string diff_base = 3;
1167}