zed.proto

   1syntax = "proto3";
   2package zed.messages;
   3
   4// Looking for a number? Search "// Current max"
   5
   6message PeerId {
   7    uint32 owner_id = 1;
   8    uint32 id = 2;
   9}
  10
  11message Envelope {
  12    uint32 id = 1;
  13    optional uint32 responding_to = 2;
  14    optional PeerId original_sender_id = 3;
  15    oneof payload {
  16        Hello hello = 4;
  17        Ack ack = 5;
  18        Error error = 6;
  19        Ping ping = 7;
  20        Test test = 8;
  21
  22        CreateRoom create_room = 9;
  23        CreateRoomResponse create_room_response = 10;
  24        JoinRoom join_room = 11;
  25        JoinRoomResponse join_room_response = 12;
  26        RejoinRoom rejoin_room = 13;
  27        RejoinRoomResponse rejoin_room_response = 14;
  28        LeaveRoom leave_room = 15;
  29        Call call = 16;
  30        IncomingCall incoming_call = 17;
  31        CallCanceled call_canceled = 18;
  32        CancelCall cancel_call = 19;
  33        DeclineCall decline_call = 20;
  34        UpdateParticipantLocation update_participant_location = 21;
  35        RoomUpdated room_updated = 22;
  36
  37        ShareProject share_project = 23;
  38        ShareProjectResponse share_project_response = 24;
  39        UnshareProject unshare_project = 25;
  40        JoinProject join_project = 26;
  41        JoinProjectResponse join_project_response = 27;
  42        LeaveProject leave_project = 28;
  43        AddProjectCollaborator add_project_collaborator = 29;
  44        UpdateProjectCollaborator update_project_collaborator = 30;
  45        RemoveProjectCollaborator remove_project_collaborator = 31;
  46
  47        GetDefinition get_definition = 32;
  48        GetDefinitionResponse get_definition_response = 33;
  49        GetTypeDefinition get_type_definition = 34;
  50        GetTypeDefinitionResponse get_type_definition_response = 35;
  51        GetReferences get_references = 36;
  52        GetReferencesResponse get_references_response = 37;
  53        GetDocumentHighlights get_document_highlights = 38;
  54        GetDocumentHighlightsResponse get_document_highlights_response = 39;
  55        GetProjectSymbols get_project_symbols = 40;
  56        GetProjectSymbolsResponse get_project_symbols_response = 41;
  57        OpenBufferForSymbol open_buffer_for_symbol = 42;
  58        OpenBufferForSymbolResponse open_buffer_for_symbol_response = 43;
  59
  60        UpdateProject update_project = 44;
  61        UpdateWorktree update_worktree = 45;
  62
  63        CreateProjectEntry create_project_entry = 46;
  64        RenameProjectEntry rename_project_entry = 47;
  65        CopyProjectEntry copy_project_entry = 48;
  66        DeleteProjectEntry delete_project_entry = 49;
  67        ProjectEntryResponse project_entry_response = 50;
  68        ExpandProjectEntry expand_project_entry = 51;
  69        ExpandProjectEntryResponse expand_project_entry_response = 52;
  70
  71        UpdateDiagnosticSummary update_diagnostic_summary = 53;
  72        StartLanguageServer start_language_server = 54;
  73        UpdateLanguageServer update_language_server = 55;
  74
  75        OpenBufferById open_buffer_by_id = 56;
  76        OpenBufferByPath open_buffer_by_path = 57;
  77        OpenBufferResponse open_buffer_response = 58;
  78        CreateBufferForPeer create_buffer_for_peer = 59;
  79        UpdateBuffer update_buffer = 60;
  80        UpdateBufferFile update_buffer_file = 61;
  81        SaveBuffer save_buffer = 62;
  82        BufferSaved buffer_saved = 63;
  83        BufferReloaded buffer_reloaded = 64;
  84        ReloadBuffers reload_buffers = 65;
  85        ReloadBuffersResponse reload_buffers_response = 66;
  86        SynchronizeBuffers synchronize_buffers = 67;
  87        SynchronizeBuffersResponse synchronize_buffers_response = 68;
  88        FormatBuffers format_buffers = 69;
  89        FormatBuffersResponse format_buffers_response = 70;
  90        GetCompletions get_completions = 71;
  91        GetCompletionsResponse get_completions_response = 72;
  92        ResolveCompletionDocumentation resolve_completion_documentation = 73;
  93        ResolveCompletionDocumentationResponse resolve_completion_documentation_response = 74;
  94        ApplyCompletionAdditionalEdits apply_completion_additional_edits = 75;
  95        ApplyCompletionAdditionalEditsResponse apply_completion_additional_edits_response = 76;
  96        GetCodeActions get_code_actions = 77;
  97        GetCodeActionsResponse get_code_actions_response = 78;
  98        GetHover get_hover = 79;
  99        GetHoverResponse get_hover_response = 80;
 100        ApplyCodeAction apply_code_action = 81;
 101        ApplyCodeActionResponse apply_code_action_response = 82;
 102        PrepareRename prepare_rename = 83;
 103        PrepareRenameResponse prepare_rename_response = 84;
 104        PerformRename perform_rename = 85;
 105        PerformRenameResponse perform_rename_response = 86;
 106        SearchProject search_project = 87;
 107        SearchProjectResponse search_project_response = 88;
 108
 109        UpdateContacts update_contacts = 89;
 110        UpdateInviteInfo update_invite_info = 90;
 111        ShowContacts show_contacts = 91;
 112
 113        GetUsers get_users = 92;
 114        FuzzySearchUsers fuzzy_search_users = 93;
 115        UsersResponse users_response = 94;
 116        RequestContact request_contact = 95;
 117        RespondToContactRequest respond_to_contact_request = 96;
 118        RemoveContact remove_contact = 97;
 119
 120        Follow follow = 98;
 121        FollowResponse follow_response = 99;
 122        UpdateFollowers update_followers = 100;
 123        Unfollow unfollow = 101;
 124        GetPrivateUserInfo get_private_user_info = 102;
 125        GetPrivateUserInfoResponse get_private_user_info_response = 103;
 126        UpdateDiffBase update_diff_base = 104;
 127
 128        OnTypeFormatting on_type_formatting = 105;
 129        OnTypeFormattingResponse on_type_formatting_response = 106;
 130
 131        UpdateWorktreeSettings update_worktree_settings = 107;
 132
 133        InlayHints inlay_hints = 108;
 134        InlayHintsResponse inlay_hints_response = 109;
 135        ResolveInlayHint resolve_inlay_hint = 110;
 136        ResolveInlayHintResponse resolve_inlay_hint_response = 111;
 137        RefreshInlayHints refresh_inlay_hints = 112;
 138
 139        CreateChannel create_channel = 113;
 140        CreateChannelResponse create_channel_response = 114;
 141        InviteChannelMember invite_channel_member = 115;
 142        RemoveChannelMember remove_channel_member = 116;
 143        RespondToChannelInvite respond_to_channel_invite = 117;
 144        UpdateChannels update_channels = 118;
 145        JoinChannel join_channel = 119;
 146        DeleteChannel delete_channel = 120;
 147        GetChannelMembers get_channel_members = 121;
 148        GetChannelMembersResponse get_channel_members_response = 122;
 149        SetChannelMemberRole set_channel_member_role = 123;
 150        RenameChannel rename_channel = 124;
 151        RenameChannelResponse rename_channel_response = 125;
 152
 153        JoinChannelBuffer join_channel_buffer = 126;
 154        JoinChannelBufferResponse join_channel_buffer_response = 127;
 155        UpdateChannelBuffer update_channel_buffer = 128;
 156        LeaveChannelBuffer leave_channel_buffer = 129;
 157        UpdateChannelBufferCollaborators update_channel_buffer_collaborators = 130;
 158        RejoinChannelBuffers rejoin_channel_buffers = 131;
 159        RejoinChannelBuffersResponse rejoin_channel_buffers_response = 132;
 160        AckBufferOperation ack_buffer_operation = 133;
 161
 162        JoinChannelChat join_channel_chat = 134;
 163        JoinChannelChatResponse join_channel_chat_response = 135;
 164        LeaveChannelChat leave_channel_chat = 136;
 165        SendChannelMessage send_channel_message = 137;
 166        SendChannelMessageResponse send_channel_message_response = 138;
 167        ChannelMessageSent channel_message_sent = 139;
 168        GetChannelMessages get_channel_messages = 140;
 169        GetChannelMessagesResponse get_channel_messages_response = 141;
 170        RemoveChannelMessage remove_channel_message = 142;
 171        AckChannelMessage ack_channel_message = 143;
 172        GetChannelMessagesById get_channel_messages_by_id = 144;
 173
 174        MoveChannel move_channel = 147;
 175        SetChannelVisibility set_channel_visibility = 148;
 176
 177        AddNotification add_notification = 149;
 178        GetNotifications get_notifications = 150;
 179        GetNotificationsResponse get_notifications_response = 151;
 180        DeleteNotification delete_notification = 152;
 181        MarkNotificationRead mark_notification_read = 153;
 182        LspExtExpandMacro lsp_ext_expand_macro = 154;
 183        LspExtExpandMacroResponse lsp_ext_expand_macro_response = 155;
 184        SetRoomParticipantRole set_room_participant_role = 156;
 185
 186        UpdateUserChannels update_user_channels = 157;
 187    }
 188
 189    reserved 158 to 161;
 190}
 191
 192// Messages
 193
 194message Hello {
 195    PeerId peer_id = 1;
 196}
 197
 198message Ping {}
 199
 200message Ack {}
 201
 202message Error {
 203    string message = 1;
 204    ErrorCode code = 2;
 205    repeated string tags = 3;
 206}
 207
 208enum ErrorCode {
 209    Internal = 0;
 210    NoSuchChannel = 1;
 211    Disconnected = 2;
 212    SignedOut = 3;
 213    UpgradeRequired = 4;
 214    Forbidden = 5;
 215    NeedsCla = 7;
 216    NotARootChannel = 8;
 217    BadPublicNesting = 9;
 218    CircularNesting = 10;
 219    WrongMoveTarget = 11;
 220    UnsharedItem = 12;
 221    reserved 6;
 222}
 223
 224message Test {
 225    uint64 id = 1;
 226}
 227
 228message CreateRoom {}
 229
 230message CreateRoomResponse {
 231    Room room = 1;
 232    optional LiveKitConnectionInfo live_kit_connection_info = 2;
 233}
 234
 235message JoinRoom {
 236    uint64 id = 1;
 237}
 238
 239message JoinRoomResponse {
 240    Room room = 1;
 241    optional uint64 channel_id = 2;
 242    optional LiveKitConnectionInfo live_kit_connection_info = 3;
 243}
 244
 245message RejoinRoom {
 246    uint64 id = 1;
 247    repeated UpdateProject reshared_projects = 2;
 248    repeated RejoinProject rejoined_projects = 3;
 249}
 250
 251message RejoinProject {
 252    uint64 id = 1;
 253    repeated RejoinWorktree worktrees = 2;
 254}
 255
 256message RejoinWorktree {
 257    uint64 id = 1;
 258    uint64 scan_id = 2;
 259}
 260
 261message RejoinRoomResponse {
 262    Room room = 1;
 263    repeated ResharedProject reshared_projects = 2;
 264    repeated RejoinedProject rejoined_projects = 3;
 265}
 266
 267message ResharedProject {
 268    uint64 id = 1;
 269    repeated Collaborator collaborators = 2;
 270}
 271
 272message RejoinedProject {
 273    uint64 id = 1;
 274    repeated WorktreeMetadata worktrees = 2;
 275    repeated Collaborator collaborators = 3;
 276    repeated LanguageServer language_servers = 4;
 277}
 278
 279message LeaveRoom {}
 280
 281message Room {
 282    uint64 id = 1;
 283    repeated Participant participants = 2;
 284    repeated PendingParticipant pending_participants = 3;
 285    repeated Follower followers = 4;
 286    string live_kit_room = 5;
 287}
 288
 289message Participant {
 290    uint64 user_id = 1;
 291    PeerId peer_id = 2;
 292    repeated ParticipantProject projects = 3;
 293    ParticipantLocation location = 4;
 294    uint32 participant_index = 5;
 295    ChannelRole role = 6;
 296    reserved 7;
 297}
 298
 299message PendingParticipant {
 300    uint64 user_id = 1;
 301    uint64 calling_user_id = 2;
 302    optional uint64 initial_project_id = 3;
 303}
 304
 305message ParticipantProject {
 306    uint64 id = 1;
 307    repeated string worktree_root_names = 2;
 308}
 309
 310message Follower {
 311    PeerId leader_id = 1;
 312    PeerId follower_id = 2;
 313    uint64 project_id = 3;
 314}
 315
 316message ParticipantLocation {
 317    oneof variant {
 318        SharedProject shared_project = 1;
 319        UnsharedProject unshared_project = 2;
 320        External external = 3;
 321    }
 322
 323    message SharedProject {
 324        uint64 id = 1;
 325    }
 326
 327    message UnsharedProject {}
 328
 329    message External {}
 330}
 331
 332message Call {
 333    uint64 room_id = 1;
 334    uint64 called_user_id = 2;
 335    optional uint64 initial_project_id = 3;
 336}
 337
 338message IncomingCall {
 339    uint64 room_id = 1;
 340    uint64 calling_user_id = 2;
 341    repeated uint64 participant_user_ids = 3;
 342    optional ParticipantProject initial_project = 4;
 343}
 344
 345message CallCanceled {
 346    uint64 room_id = 1;
 347}
 348
 349message CancelCall {
 350    uint64 room_id = 1;
 351    uint64 called_user_id = 2;
 352}
 353
 354message DeclineCall {
 355    uint64 room_id = 1;
 356}
 357
 358message UpdateParticipantLocation {
 359    uint64 room_id = 1;
 360    ParticipantLocation location = 2;
 361}
 362
 363message RoomUpdated {
 364    Room room = 1;
 365}
 366
 367message LiveKitConnectionInfo {
 368    string server_url = 1;
 369    string token = 2;
 370    bool can_publish = 3;
 371}
 372
 373message ShareProject {
 374    uint64 room_id = 1;
 375    repeated WorktreeMetadata worktrees = 2;
 376}
 377
 378message ShareProjectResponse {
 379    uint64 project_id = 1;
 380}
 381
 382message UnshareProject {
 383    uint64 project_id = 1;
 384}
 385
 386message UpdateProject {
 387    uint64 project_id = 1;
 388    repeated WorktreeMetadata worktrees = 2;
 389}
 390
 391message JoinProject {
 392    uint64 project_id = 1;
 393}
 394
 395message JoinProjectResponse {
 396    uint32 replica_id = 1;
 397    repeated WorktreeMetadata worktrees = 2;
 398    repeated Collaborator collaborators = 3;
 399    repeated LanguageServer language_servers = 4;
 400}
 401
 402message LeaveProject {
 403    uint64 project_id = 1;
 404}
 405
 406message UpdateWorktree {
 407    uint64 project_id = 1;
 408    uint64 worktree_id = 2;
 409    string root_name = 3;
 410    repeated Entry updated_entries = 4;
 411    repeated uint64 removed_entries = 5;
 412    repeated RepositoryEntry updated_repositories = 6;
 413    repeated uint64 removed_repositories = 7;
 414    uint64 scan_id = 8;
 415    bool is_last_update = 9;
 416    string abs_path = 10;
 417}
 418
 419message UpdateWorktreeSettings {
 420    uint64 project_id = 1;
 421    uint64 worktree_id = 2;
 422    string path = 3;
 423    optional string content = 4;
 424}
 425
 426message CreateProjectEntry {
 427    uint64 project_id = 1;
 428    uint64 worktree_id = 2;
 429    string path = 3;
 430    bool is_directory = 4;
 431}
 432
 433message RenameProjectEntry {
 434    uint64 project_id = 1;
 435    uint64 entry_id = 2;
 436    string new_path = 3;
 437}
 438
 439message CopyProjectEntry {
 440    uint64 project_id = 1;
 441    uint64 entry_id = 2;
 442    string new_path = 3;
 443}
 444
 445message DeleteProjectEntry {
 446    uint64 project_id = 1;
 447    uint64 entry_id = 2;
 448}
 449
 450message ExpandProjectEntry {
 451    uint64 project_id = 1;
 452    uint64 entry_id = 2;
 453}
 454
 455message ExpandProjectEntryResponse {
 456    uint64 worktree_scan_id = 1;
 457}
 458
 459message ProjectEntryResponse {
 460    optional Entry entry = 1;
 461    uint64 worktree_scan_id = 2;
 462}
 463
 464message AddProjectCollaborator {
 465    uint64 project_id = 1;
 466    Collaborator collaborator = 2;
 467}
 468
 469message UpdateProjectCollaborator {
 470    uint64 project_id = 1;
 471    PeerId old_peer_id = 2;
 472    PeerId new_peer_id = 3;
 473}
 474
 475message RemoveProjectCollaborator {
 476    uint64 project_id = 1;
 477    PeerId peer_id = 2;
 478}
 479
 480message UpdateChannelBufferCollaborators {
 481    uint64 channel_id = 1;
 482    repeated Collaborator collaborators = 2;
 483}
 484
 485message GetDefinition {
 486     uint64 project_id = 1;
 487     uint64 buffer_id = 2;
 488     Anchor position = 3;
 489     repeated VectorClockEntry version = 4;
 490 }
 491
 492message GetDefinitionResponse {
 493    repeated LocationLink links = 1;
 494}
 495
 496message GetTypeDefinition {
 497     uint64 project_id = 1;
 498     uint64 buffer_id = 2;
 499     Anchor position = 3;
 500     repeated VectorClockEntry version = 4;
 501 }
 502
 503message GetTypeDefinitionResponse {
 504    repeated LocationLink links = 1;
 505}
 506
 507message GetReferences {
 508     uint64 project_id = 1;
 509     uint64 buffer_id = 2;
 510     Anchor position = 3;
 511     repeated VectorClockEntry version = 4;
 512 }
 513
 514message GetReferencesResponse {
 515    repeated Location locations = 1;
 516}
 517
 518message GetDocumentHighlights {
 519     uint64 project_id = 1;
 520     uint64 buffer_id = 2;
 521     Anchor position = 3;
 522     repeated VectorClockEntry version = 4;
 523 }
 524
 525message GetDocumentHighlightsResponse {
 526    repeated DocumentHighlight highlights = 1;
 527}
 528
 529message Location {
 530    uint64 buffer_id = 1;
 531    Anchor start = 2;
 532    Anchor end = 3;
 533}
 534
 535message LocationLink {
 536    optional Location origin = 1;
 537    Location target = 2;
 538}
 539
 540message DocumentHighlight {
 541    Kind kind = 1;
 542    Anchor start = 2;
 543    Anchor end = 3;
 544
 545    enum Kind {
 546        Text = 0;
 547        Read = 1;
 548        Write = 2;
 549    }
 550}
 551
 552message GetProjectSymbols {
 553    uint64 project_id = 1;
 554    string query = 2;
 555}
 556
 557message GetProjectSymbolsResponse {
 558    repeated Symbol symbols = 4;
 559}
 560
 561message Symbol {
 562    uint64 source_worktree_id = 1;
 563    uint64 worktree_id = 2;
 564    string language_server_name = 3;
 565    string name = 4;
 566    int32 kind = 5;
 567    string path = 6;
 568    // Cannot use generate anchors for unopened files,
 569    // so we are forced to use point coords instead
 570    PointUtf16 start = 7;
 571    PointUtf16 end = 8;
 572    bytes signature = 9;
 573}
 574
 575message OpenBufferForSymbol {
 576    uint64 project_id = 1;
 577    Symbol symbol = 2;
 578}
 579
 580message OpenBufferForSymbolResponse {
 581    uint64 buffer_id = 1;
 582}
 583
 584message OpenBufferByPath {
 585    uint64 project_id = 1;
 586    uint64 worktree_id = 2;
 587    string path = 3;
 588}
 589
 590message OpenBufferById {
 591    uint64 project_id = 1;
 592    uint64 id = 2;
 593}
 594
 595message OpenBufferResponse {
 596    uint64 buffer_id = 1;
 597}
 598
 599message CreateBufferForPeer {
 600    uint64 project_id = 1;
 601    PeerId peer_id = 2;
 602    oneof variant {
 603        BufferState state = 3;
 604        BufferChunk chunk = 4;
 605    }
 606}
 607
 608message UpdateBuffer {
 609    uint64 project_id = 1;
 610    uint64 buffer_id = 2;
 611    repeated Operation operations = 3;
 612}
 613
 614message UpdateChannelBuffer {
 615    uint64 channel_id = 1;
 616    repeated Operation operations = 2;
 617}
 618
 619message UpdateBufferFile {
 620    uint64 project_id = 1;
 621    uint64 buffer_id = 2;
 622    File file = 3;
 623}
 624
 625message SaveBuffer {
 626    uint64 project_id = 1;
 627    uint64 buffer_id = 2;
 628    repeated VectorClockEntry version = 3;
 629}
 630
 631message BufferSaved {
 632    uint64 project_id = 1;
 633    uint64 buffer_id = 2;
 634    repeated VectorClockEntry version = 3;
 635    Timestamp mtime = 4;
 636    string fingerprint = 5;
 637}
 638
 639message BufferReloaded {
 640    uint64 project_id = 1;
 641    uint64 buffer_id = 2;
 642    repeated VectorClockEntry version = 3;
 643    Timestamp mtime = 4;
 644    string fingerprint = 5;
 645    LineEnding line_ending = 6;
 646}
 647
 648message ReloadBuffers {
 649    uint64 project_id = 1;
 650    repeated uint64 buffer_ids = 2;
 651}
 652
 653message ReloadBuffersResponse {
 654    ProjectTransaction transaction = 1;
 655}
 656
 657message SynchronizeBuffers {
 658    uint64 project_id = 1;
 659    repeated BufferVersion buffers = 2;
 660}
 661
 662message SynchronizeBuffersResponse {
 663    repeated BufferVersion buffers = 1;
 664}
 665
 666message BufferVersion {
 667    uint64 id = 1;
 668    repeated VectorClockEntry version = 2;
 669}
 670
 671message ChannelBufferVersion {
 672    uint64 channel_id = 1;
 673    repeated VectorClockEntry version = 2;
 674    uint64 epoch = 3;
 675}
 676
 677enum FormatTrigger {
 678    Save = 0;
 679    Manual = 1;
 680}
 681
 682message FormatBuffers {
 683    uint64 project_id = 1;
 684    FormatTrigger trigger = 2;
 685    repeated uint64 buffer_ids = 3;
 686}
 687
 688message FormatBuffersResponse {
 689    ProjectTransaction transaction = 1;
 690}
 691
 692message GetCompletions {
 693    uint64 project_id = 1;
 694    uint64 buffer_id = 2;
 695    Anchor position = 3;
 696    repeated VectorClockEntry version = 4;
 697}
 698
 699message GetCompletionsResponse {
 700    repeated Completion completions = 1;
 701    repeated VectorClockEntry version = 2;
 702}
 703
 704message ApplyCompletionAdditionalEdits {
 705    uint64 project_id = 1;
 706    uint64 buffer_id = 2;
 707    Completion completion = 3;
 708}
 709
 710message ApplyCompletionAdditionalEditsResponse {
 711    Transaction transaction = 1;
 712}
 713
 714message Completion {
 715    Anchor old_start = 1;
 716    Anchor old_end = 2;
 717    string new_text = 3;
 718    uint64 server_id = 4;
 719    bytes lsp_completion = 5;
 720}
 721
 722message GetCodeActions {
 723    uint64 project_id = 1;
 724    uint64 buffer_id = 2;
 725    Anchor start = 3;
 726    Anchor end = 4;
 727    repeated VectorClockEntry version = 5;
 728}
 729
 730message GetCodeActionsResponse {
 731    repeated CodeAction actions = 1;
 732    repeated VectorClockEntry version = 2;
 733}
 734
 735message GetHover {
 736    uint64 project_id = 1;
 737    uint64 buffer_id = 2;
 738    Anchor position = 3;
 739    repeated VectorClockEntry version = 5;
 740}
 741
 742message GetHoverResponse {
 743    optional Anchor start = 1;
 744    optional Anchor end = 2;
 745    repeated HoverBlock contents = 3;
 746}
 747
 748message HoverBlock {
 749    string text = 1;
 750    optional string language = 2;
 751    bool is_markdown = 3;
 752}
 753
 754message ApplyCodeAction {
 755    uint64 project_id = 1;
 756    uint64 buffer_id = 2;
 757    CodeAction action = 3;
 758}
 759
 760message ApplyCodeActionResponse {
 761    ProjectTransaction transaction = 1;
 762}
 763
 764message PrepareRename {
 765    uint64 project_id = 1;
 766    uint64 buffer_id = 2;
 767    Anchor position = 3;
 768    repeated VectorClockEntry version = 4;
 769}
 770
 771message PrepareRenameResponse {
 772    bool can_rename = 1;
 773    Anchor start = 2;
 774    Anchor end = 3;
 775    repeated VectorClockEntry version = 4;
 776}
 777
 778message PerformRename {
 779    uint64 project_id = 1;
 780    uint64 buffer_id = 2;
 781    Anchor position = 3;
 782    string new_name = 4;
 783    repeated VectorClockEntry version = 5;
 784}
 785
 786message OnTypeFormatting {
 787    uint64 project_id = 1;
 788    uint64 buffer_id = 2;
 789    Anchor position = 3;
 790    string trigger = 4;
 791    repeated VectorClockEntry version = 5;
 792}
 793
 794message OnTypeFormattingResponse {
 795    Transaction transaction = 1;
 796}
 797
 798message InlayHints {
 799    uint64 project_id = 1;
 800    uint64 buffer_id = 2;
 801    Anchor start = 3;
 802    Anchor end = 4;
 803    repeated VectorClockEntry version = 5;
 804}
 805
 806message InlayHintsResponse {
 807    repeated InlayHint hints = 1;
 808    repeated VectorClockEntry version = 2;
 809}
 810
 811message InlayHint {
 812    Anchor position = 1;
 813    InlayHintLabel label = 2;
 814    optional string kind = 3;
 815    bool padding_left = 4;
 816    bool padding_right = 5;
 817    InlayHintTooltip tooltip = 6;
 818    ResolveState resolve_state = 7;
 819}
 820
 821message InlayHintLabel {
 822    oneof label {
 823        string value = 1;
 824        InlayHintLabelParts label_parts = 2;
 825    }
 826}
 827
 828message InlayHintLabelParts {
 829    repeated InlayHintLabelPart parts = 1;
 830}
 831
 832message InlayHintLabelPart {
 833    string value = 1;
 834    InlayHintLabelPartTooltip tooltip = 2;
 835    optional string location_url = 3;
 836    PointUtf16 location_range_start = 4;
 837    PointUtf16 location_range_end = 5;
 838    optional uint64 language_server_id = 6;
 839}
 840
 841message InlayHintTooltip {
 842    oneof content {
 843        string value = 1;
 844        MarkupContent markup_content = 2;
 845    }
 846}
 847
 848message InlayHintLabelPartTooltip {
 849    oneof content {
 850        string value = 1;
 851        MarkupContent markup_content = 2;
 852    }
 853}
 854
 855message ResolveState {
 856    State state = 1;
 857    LspResolveState lsp_resolve_state = 2;
 858
 859    enum State {
 860        Resolved = 0;
 861        CanResolve = 1;
 862        Resolving = 2;
 863    }
 864
 865    message LspResolveState {
 866        string value = 1;
 867        uint64 server_id = 2;
 868    }
 869}
 870
 871message ResolveCompletionDocumentation {
 872    uint64 project_id = 1;
 873    uint64 language_server_id = 2;
 874    bytes lsp_completion = 3;
 875}
 876
 877message ResolveCompletionDocumentationResponse {
 878    string text = 1;
 879    bool is_markdown = 2;
 880}
 881
 882message ResolveInlayHint {
 883    uint64 project_id = 1;
 884    uint64 buffer_id = 2;
 885    uint64 language_server_id = 3;
 886    InlayHint hint = 4;
 887}
 888
 889message ResolveInlayHintResponse {
 890    InlayHint hint = 1;
 891}
 892
 893message RefreshInlayHints {
 894    uint64 project_id = 1;
 895}
 896
 897message MarkupContent {
 898    bool is_markdown = 1;
 899    string value = 2;
 900}
 901
 902message PerformRenameResponse {
 903    ProjectTransaction transaction = 2;
 904}
 905
 906message SearchProject {
 907    uint64 project_id = 1;
 908    string query = 2;
 909    bool regex = 3;
 910    bool whole_word = 4;
 911    bool case_sensitive = 5;
 912    string files_to_include = 6;
 913    string files_to_exclude = 7;
 914    bool include_ignored = 8;
 915}
 916
 917message SearchProjectResponse {
 918    repeated Location locations = 1;
 919}
 920
 921message CodeAction {
 922    uint64 server_id = 1;
 923    Anchor start = 2;
 924    Anchor end = 3;
 925    bytes lsp_action = 4;
 926}
 927
 928message ProjectTransaction {
 929    repeated uint64 buffer_ids = 1;
 930    repeated Transaction transactions = 2;
 931}
 932
 933message Transaction {
 934    LamportTimestamp id = 1;
 935    repeated LamportTimestamp edit_ids = 2;
 936    repeated VectorClockEntry start = 3;
 937}
 938
 939message LamportTimestamp {
 940    uint32 replica_id = 1;
 941    uint32 value = 2;
 942}
 943
 944message LanguageServer {
 945    uint64 id = 1;
 946    string name = 2;
 947}
 948
 949message StartLanguageServer {
 950    uint64 project_id = 1;
 951    LanguageServer server = 2;
 952}
 953
 954message UpdateDiagnosticSummary {
 955    uint64 project_id = 1;
 956    uint64 worktree_id = 2;
 957    DiagnosticSummary summary = 3;
 958}
 959
 960message DiagnosticSummary {
 961    string path = 1;
 962    uint64 language_server_id = 2;
 963    uint32 error_count = 3;
 964    uint32 warning_count = 4;
 965}
 966
 967message UpdateLanguageServer {
 968    uint64 project_id = 1;
 969    uint64 language_server_id = 2;
 970    oneof variant {
 971        LspWorkStart work_start = 3;
 972        LspWorkProgress work_progress = 4;
 973        LspWorkEnd work_end = 5;
 974        LspDiskBasedDiagnosticsUpdating disk_based_diagnostics_updating = 6;
 975        LspDiskBasedDiagnosticsUpdated disk_based_diagnostics_updated = 7;
 976    }
 977}
 978
 979message LspWorkStart {
 980    string token = 1;
 981    optional string message = 2;
 982    optional uint32 percentage = 3;
 983}
 984
 985message LspWorkProgress {
 986    string token = 1;
 987    optional string message = 2;
 988    optional uint32 percentage = 3;
 989}
 990
 991message LspWorkEnd {
 992    string token = 1;
 993}
 994
 995message LspDiskBasedDiagnosticsUpdating {}
 996
 997message LspDiskBasedDiagnosticsUpdated {}
 998
 999message UpdateChannels {
1000    repeated Channel channels = 1;
1001    repeated uint64 delete_channels = 4;
1002    repeated Channel channel_invitations = 5;
1003    repeated uint64 remove_channel_invitations = 6;
1004    repeated ChannelParticipants channel_participants = 7;
1005    repeated ChannelMessageId latest_channel_message_ids = 8;
1006    repeated ChannelBufferVersion latest_channel_buffer_versions = 9;
1007}
1008
1009message UpdateUserChannels {
1010    repeated ChannelMessageId observed_channel_message_id = 1;
1011    repeated ChannelBufferVersion observed_channel_buffer_version = 2;
1012    repeated ChannelMembership channel_memberships = 3;
1013}
1014
1015message ChannelMembership {
1016    uint64 channel_id = 1;
1017    ChannelRole role = 2;
1018}
1019
1020message ChannelMessageId {
1021    uint64 channel_id = 1;
1022    uint64 message_id = 2;
1023}
1024
1025message ChannelPermission {
1026    uint64 channel_id = 1;
1027    ChannelRole role = 3;
1028}
1029
1030message ChannelParticipants {
1031    uint64 channel_id = 1;
1032    repeated uint64 participant_user_ids = 2;
1033}
1034
1035message JoinChannel {
1036    uint64 channel_id = 1;
1037}
1038
1039message DeleteChannel {
1040    uint64 channel_id = 1;
1041}
1042
1043message GetChannelMembers {
1044    uint64 channel_id = 1;
1045}
1046
1047message GetChannelMembersResponse {
1048    repeated ChannelMember members = 1;
1049}
1050
1051message ChannelMember {
1052    uint64 user_id = 1;
1053    Kind kind = 3;
1054    ChannelRole role = 4;
1055
1056    enum Kind {
1057        Member = 0;
1058        Invitee = 1;
1059    }
1060}
1061
1062message CreateChannel {
1063    string name = 1;
1064    optional uint64 parent_id = 2;
1065}
1066
1067message CreateChannelResponse {
1068    Channel channel = 1;
1069    optional uint64 parent_id = 2;
1070}
1071
1072message InviteChannelMember {
1073    uint64 channel_id = 1;
1074    uint64 user_id = 2;
1075    ChannelRole role = 4;
1076}
1077
1078message RemoveChannelMember {
1079    uint64 channel_id = 1;
1080    uint64 user_id = 2;
1081}
1082
1083enum ChannelRole {
1084    Admin = 0;
1085    Member = 1;
1086    Guest = 2;
1087    Banned = 3;
1088}
1089
1090message SetChannelMemberRole {
1091    uint64 channel_id = 1;
1092    uint64 user_id = 2;
1093    ChannelRole role = 3;
1094}
1095
1096message SetChannelVisibility {
1097    uint64 channel_id = 1;
1098    ChannelVisibility visibility = 2;
1099}
1100
1101message RenameChannel {
1102    uint64 channel_id = 1;
1103    string name = 2;
1104}
1105
1106message RenameChannelResponse {
1107    Channel channel = 1;
1108}
1109
1110message JoinChannelChat {
1111    uint64 channel_id = 1;
1112}
1113
1114message JoinChannelChatResponse {
1115    repeated ChannelMessage messages = 1;
1116    bool done = 2;
1117}
1118
1119message LeaveChannelChat {
1120    uint64 channel_id = 1;
1121}
1122
1123message SendChannelMessage {
1124    uint64 channel_id = 1;
1125    string body = 2;
1126    Nonce nonce = 3;
1127    repeated ChatMention mentions = 4;
1128    optional uint64 reply_to_message_id = 5;
1129}
1130
1131message RemoveChannelMessage {
1132    uint64 channel_id = 1;
1133    uint64 message_id = 2;
1134}
1135
1136message AckChannelMessage {
1137    uint64 channel_id = 1;
1138    uint64 message_id = 2;
1139}
1140
1141message SendChannelMessageResponse {
1142    ChannelMessage message = 1;
1143}
1144
1145message ChannelMessageSent {
1146    uint64 channel_id = 1;
1147    ChannelMessage message = 2;
1148}
1149
1150message GetChannelMessages {
1151    uint64 channel_id = 1;
1152    uint64 before_message_id = 2;
1153}
1154
1155message GetChannelMessagesResponse {
1156    repeated ChannelMessage messages = 1;
1157    bool done = 2;
1158}
1159
1160message GetChannelMessagesById {
1161    repeated uint64 message_ids = 1;
1162}
1163
1164message MoveChannel {
1165    uint64 channel_id = 1;
1166    uint64 to = 2;
1167}
1168
1169message JoinChannelBuffer {
1170    uint64 channel_id = 1;
1171}
1172
1173message ChannelMessage {
1174    uint64 id = 1;
1175    string body = 2;
1176    uint64 timestamp = 3;
1177    uint64 sender_id = 4;
1178    Nonce nonce = 5;
1179    repeated ChatMention mentions = 6;
1180    optional uint64 reply_to_message_id = 7;
1181}
1182
1183message ChatMention {
1184    Range range = 1;
1185    uint64 user_id = 2;
1186}
1187
1188message RejoinChannelBuffers {
1189    repeated ChannelBufferVersion buffers = 1;
1190}
1191
1192message RejoinChannelBuffersResponse {
1193    repeated RejoinedChannelBuffer buffers = 1;
1194}
1195
1196message AckBufferOperation {
1197    uint64 buffer_id = 1;
1198    uint64 epoch = 2;
1199    repeated VectorClockEntry version = 3;
1200}
1201
1202message JoinChannelBufferResponse {
1203    uint64 buffer_id = 1;
1204    uint32 replica_id = 2;
1205    string base_text = 3;
1206    repeated Operation operations = 4;
1207    repeated Collaborator collaborators = 5;
1208    uint64 epoch = 6;
1209}
1210
1211message RejoinedChannelBuffer {
1212    uint64 channel_id = 1;
1213    repeated VectorClockEntry version = 2;
1214    repeated Operation operations = 3;
1215    repeated Collaborator collaborators = 4;
1216}
1217
1218message LeaveChannelBuffer {
1219    uint64 channel_id = 1;
1220}
1221
1222message RespondToChannelInvite {
1223    uint64 channel_id = 1;
1224    bool accept = 2;
1225}
1226
1227message GetUsers {
1228    repeated uint64 user_ids = 1;
1229}
1230
1231message FuzzySearchUsers {
1232    string query = 1;
1233}
1234
1235message UsersResponse {
1236    repeated User users = 1;
1237}
1238
1239message RequestContact {
1240    uint64 responder_id = 1;
1241}
1242
1243message RemoveContact {
1244    uint64 user_id = 1;
1245}
1246
1247message RespondToContactRequest {
1248    uint64 requester_id = 1;
1249    ContactRequestResponse response = 2;
1250}
1251
1252enum ContactRequestResponse {
1253    Accept = 0;
1254    Decline = 1;
1255    Block = 2;
1256    Dismiss = 3;
1257}
1258
1259message UpdateContacts {
1260    repeated Contact contacts = 1;
1261    repeated uint64 remove_contacts = 2;
1262    repeated IncomingContactRequest incoming_requests = 3;
1263    repeated uint64 remove_incoming_requests = 4;
1264    repeated uint64 outgoing_requests = 5;
1265    repeated uint64 remove_outgoing_requests = 6;
1266}
1267
1268message UpdateInviteInfo {
1269    string url = 1;
1270    uint32 count = 2;
1271}
1272
1273message ShowContacts {}
1274
1275message IncomingContactRequest {
1276    uint64 requester_id = 1;
1277}
1278
1279message UpdateDiagnostics {
1280    uint32 replica_id = 1;
1281    uint32 lamport_timestamp = 2;
1282    uint64 server_id = 3;
1283    repeated Diagnostic diagnostics = 4;
1284}
1285
1286message Follow {
1287    uint64 room_id = 1;
1288    optional uint64 project_id = 2;
1289    PeerId leader_id = 3;
1290}
1291
1292message FollowResponse {
1293    View active_view = 3;
1294    // TODO: after 0.124.0 is retired, remove these.
1295    optional ViewId active_view_id = 1;
1296    repeated View views = 2;
1297}
1298
1299message UpdateFollowers {
1300    uint64 room_id = 1;
1301    optional uint64 project_id = 2;
1302    reserved 3;
1303    oneof variant {
1304        View create_view = 5;
1305        // TODO: after 0.124.0 is retired, remove these.
1306        UpdateActiveView update_active_view = 4;
1307        UpdateView update_view = 6;
1308    }
1309}
1310
1311message Unfollow {
1312    uint64 room_id = 1;
1313    optional uint64 project_id = 2;
1314    PeerId leader_id = 3;
1315}
1316
1317message GetPrivateUserInfo {}
1318
1319message GetPrivateUserInfoResponse {
1320    string metrics_id = 1;
1321    bool staff = 2;
1322    repeated string flags = 3;
1323}
1324
1325// Entities
1326
1327message ViewId {
1328    PeerId creator = 1;
1329    uint64 id = 2;
1330}
1331
1332message UpdateActiveView {
1333    optional ViewId id = 1;
1334    optional PeerId leader_id = 2;
1335    View view = 3;
1336}
1337
1338message UpdateView {
1339    ViewId id = 1;
1340    optional PeerId leader_id = 2;
1341
1342    oneof variant {
1343        Editor editor = 3;
1344    }
1345
1346    message Editor {
1347        repeated ExcerptInsertion inserted_excerpts = 1;
1348        repeated uint64 deleted_excerpts = 2;
1349        repeated Selection selections = 3;
1350        optional Selection pending_selection = 4;
1351        EditorAnchor scroll_top_anchor = 5;
1352        float scroll_x = 6;
1353        float scroll_y = 7;
1354    }
1355}
1356
1357message View {
1358    ViewId id = 1;
1359    optional PeerId leader_id = 2;
1360
1361    oneof variant {
1362        Editor editor = 3;
1363        ChannelView channel_view = 4;
1364    }
1365
1366    message Editor {
1367        bool singleton = 1;
1368        optional string title = 2;
1369        repeated Excerpt excerpts = 3;
1370        repeated Selection selections = 4;
1371        optional Selection pending_selection = 5;
1372        EditorAnchor scroll_top_anchor = 6;
1373        float scroll_x = 7;
1374        float scroll_y = 8;
1375    }
1376
1377    message ChannelView {
1378        uint64 channel_id = 1;
1379        Editor editor = 2;
1380    }
1381}
1382
1383message Collaborator {
1384    PeerId peer_id = 1;
1385    uint32 replica_id = 2;
1386    uint64 user_id = 3;
1387}
1388
1389message User {
1390    uint64 id = 1;
1391    string github_login = 2;
1392    string avatar_url = 3;
1393}
1394
1395message File {
1396    uint64 worktree_id = 1;
1397    optional uint64 entry_id = 2;
1398    string path = 3;
1399    Timestamp mtime = 4;
1400    bool is_deleted = 5;
1401}
1402
1403message Entry {
1404    uint64 id = 1;
1405    bool is_dir = 2;
1406    string path = 3;
1407    uint64 inode = 4;
1408    Timestamp mtime = 5;
1409    bool is_symlink = 6;
1410    bool is_ignored = 7;
1411    bool is_external = 8;
1412    optional GitStatus git_status = 9;
1413}
1414
1415message RepositoryEntry {
1416    uint64 work_directory_id = 1;
1417    optional string branch = 2;
1418}
1419
1420message StatusEntry {
1421    string repo_path = 1;
1422    GitStatus status = 2;
1423}
1424
1425enum GitStatus {
1426    Added = 0;
1427    Modified = 1;
1428    Conflict = 2;
1429}
1430
1431message BufferState {
1432    uint64 id = 1;
1433    optional File file = 2;
1434    string base_text = 3;
1435    optional string diff_base = 4;
1436    LineEnding line_ending = 5;
1437    repeated VectorClockEntry saved_version = 6;
1438    string saved_version_fingerprint = 7;
1439    Timestamp saved_mtime = 8;
1440}
1441
1442message BufferChunk {
1443    uint64 buffer_id = 1;
1444    repeated Operation operations = 2;
1445    bool is_last = 3;
1446}
1447
1448enum LineEnding {
1449    Unix = 0;
1450    Windows = 1;
1451}
1452
1453message Selection {
1454    uint64 id = 1;
1455    EditorAnchor start = 2;
1456    EditorAnchor end = 3;
1457    bool reversed = 4;
1458}
1459
1460message EditorAnchor {
1461    uint64 excerpt_id = 1;
1462    Anchor anchor = 2;
1463}
1464
1465enum CursorShape {
1466    CursorBar = 0;
1467    CursorBlock = 1;
1468    CursorUnderscore = 2;
1469    CursorHollow = 3;
1470}
1471
1472message ExcerptInsertion {
1473    Excerpt excerpt = 1;
1474    optional uint64 previous_excerpt_id = 2;
1475}
1476
1477message Excerpt {
1478    uint64 id = 1;
1479    uint64 buffer_id = 2;
1480    Anchor context_start = 3;
1481    Anchor context_end = 4;
1482    Anchor primary_start = 5;
1483    Anchor primary_end = 6;
1484}
1485
1486message Anchor {
1487    uint32 replica_id = 1;
1488    uint32 timestamp = 2;
1489    uint64 offset = 3;
1490    Bias bias = 4;
1491    optional uint64 buffer_id = 5;
1492}
1493
1494enum Bias {
1495    Left = 0;
1496    Right = 1;
1497}
1498
1499message Diagnostic {
1500    Anchor start = 1;
1501    Anchor end = 2;
1502    optional string source = 3;
1503    Severity severity = 4;
1504    string message = 5;
1505    optional string code = 6;
1506    uint64 group_id = 7;
1507    bool is_primary = 8;
1508
1509    // TODO: remove this field
1510    bool is_valid = 9;
1511
1512    bool is_disk_based = 10;
1513    bool is_unnecessary = 11;
1514
1515    enum Severity {
1516        None = 0;
1517        Error = 1;
1518        Warning = 2;
1519        Information = 3;
1520        Hint = 4;
1521    }
1522}
1523
1524message Operation {
1525    oneof variant {
1526        Edit edit = 1;
1527        Undo undo = 2;
1528        UpdateSelections update_selections = 3;
1529        UpdateDiagnostics update_diagnostics = 4;
1530        UpdateCompletionTriggers update_completion_triggers = 5;
1531    }
1532
1533    message Edit {
1534        uint32 replica_id = 1;
1535        uint32 lamport_timestamp = 2;
1536        repeated VectorClockEntry version = 3;
1537        repeated Range ranges = 4;
1538        repeated string new_text = 5;
1539    }
1540
1541    message Undo {
1542        uint32 replica_id = 1;
1543        uint32 lamport_timestamp = 2;
1544        repeated VectorClockEntry version = 3;
1545        repeated UndoCount counts = 4;
1546    }
1547
1548    message UpdateSelections {
1549        uint32 replica_id = 1;
1550        uint32 lamport_timestamp = 2;
1551        repeated Selection selections = 3;
1552        bool line_mode = 4;
1553        CursorShape cursor_shape = 5;
1554    }
1555
1556    message UpdateCompletionTriggers {
1557        uint32 replica_id = 1;
1558        uint32 lamport_timestamp = 2;
1559        repeated string triggers = 3;
1560    }
1561}
1562
1563message UndoMapEntry {
1564    uint32 replica_id = 1;
1565    uint32 local_timestamp = 2;
1566    repeated UndoCount counts = 3;
1567}
1568
1569message UndoCount {
1570    uint32 replica_id = 1;
1571    uint32 lamport_timestamp = 2;
1572    uint32 count = 3;
1573}
1574
1575message VectorClockEntry {
1576    uint32 replica_id = 1;
1577    uint32 timestamp = 2;
1578}
1579
1580message Timestamp {
1581    uint64 seconds = 1;
1582    uint32 nanos = 2;
1583}
1584
1585message Range {
1586    uint64 start = 1;
1587    uint64 end = 2;
1588}
1589
1590message PointUtf16 {
1591    uint32 row = 1;
1592    uint32 column = 2;
1593}
1594
1595message Nonce {
1596    uint64 upper_half = 1;
1597    uint64 lower_half = 2;
1598}
1599
1600enum ChannelVisibility {
1601    Public = 0;
1602    Members = 1;
1603}
1604
1605message Channel {
1606    uint64 id = 1;
1607    string name = 2;
1608    ChannelVisibility visibility = 3;
1609    repeated uint64 parent_path = 5;
1610}
1611
1612message Contact {
1613    uint64 user_id = 1;
1614    bool online = 2;
1615    bool busy = 3;
1616}
1617
1618message WorktreeMetadata {
1619    uint64 id = 1;
1620    string root_name = 2;
1621    bool visible = 3;
1622    string abs_path = 4;
1623}
1624
1625message UpdateDiffBase {
1626    uint64 project_id = 1;
1627    uint64 buffer_id = 2;
1628    optional string diff_base = 3;
1629}
1630
1631message GetNotifications {
1632    optional uint64 before_id = 1;
1633}
1634
1635message AddNotification {
1636    Notification notification = 1;
1637}
1638
1639message GetNotificationsResponse {
1640    repeated Notification notifications = 1;
1641    bool done = 2;
1642}
1643
1644message DeleteNotification {
1645    uint64 notification_id = 1;
1646}
1647
1648message MarkNotificationRead {
1649    uint64 notification_id = 1;
1650}
1651
1652message Notification {
1653    uint64 id = 1;
1654    uint64 timestamp = 2;
1655    string kind = 3;
1656    optional uint64 entity_id = 4;
1657    string content = 5;
1658    bool is_read = 6;
1659    optional bool response = 7;
1660}
1661
1662message LspExtExpandMacro {
1663    uint64 project_id = 1;
1664    uint64 buffer_id = 2;
1665    Anchor position = 3;
1666}
1667
1668message LspExtExpandMacroResponse {
1669    string name = 1;
1670    string expansion = 2;
1671}
1672
1673message SetRoomParticipantRole {
1674    uint64 room_id = 1;
1675    uint64 user_id = 2;
1676    ChannelRole role = 3;
1677}