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