zed.proto

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