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