mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-11 21:13:02 +00:00
Start defining follow protocol
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
c8a6226e03
commit
4bbfd0918e
4 changed files with 65 additions and 28 deletions
|
@ -279,7 +279,7 @@ impl Project {
|
|||
client.add_entity_request_handler(Self::handle_search_project);
|
||||
client.add_entity_request_handler(Self::handle_get_project_symbols);
|
||||
client.add_entity_request_handler(Self::handle_open_buffer_for_symbol);
|
||||
client.add_entity_request_handler(Self::handle_open_buffer);
|
||||
client.add_entity_request_handler(Self::handle_open_buffer_by_path);
|
||||
client.add_entity_request_handler(Self::handle_save_buffer);
|
||||
}
|
||||
|
||||
|
@ -930,7 +930,7 @@ impl Project {
|
|||
let path_string = path.to_string_lossy().to_string();
|
||||
cx.spawn(|this, mut cx| async move {
|
||||
let response = rpc
|
||||
.request(proto::OpenBuffer {
|
||||
.request(proto::OpenBufferByPath {
|
||||
project_id,
|
||||
worktree_id: remote_worktree_id.to_proto(),
|
||||
path: path_string,
|
||||
|
@ -3887,9 +3887,9 @@ impl Project {
|
|||
hasher.finalize().as_slice().try_into().unwrap()
|
||||
}
|
||||
|
||||
async fn handle_open_buffer(
|
||||
async fn handle_open_buffer_by_path(
|
||||
this: ModelHandle<Self>,
|
||||
envelope: TypedEnvelope<proto::OpenBuffer>,
|
||||
envelope: TypedEnvelope<proto::OpenBufferByPath>,
|
||||
_: Arc<Client>,
|
||||
mut cx: AsyncAppContext,
|
||||
) -> Result<proto::OpenBufferResponse> {
|
||||
|
|
|
@ -40,8 +40,9 @@ message Envelope {
|
|||
StartLanguageServer start_language_server = 33;
|
||||
UpdateLanguageServer update_language_server = 34;
|
||||
|
||||
OpenBuffer open_buffer = 35;
|
||||
OpenBufferResponse open_buffer_response = 36;
|
||||
OpenBufferById open_buffer_by_id = 35;
|
||||
OpenBufferByPath open_buffer_by_path = 36;
|
||||
OpenBufferResponse open_buffer_response = 37;
|
||||
UpdateBuffer update_buffer = 38;
|
||||
UpdateBufferFile update_buffer_file = 39;
|
||||
SaveBuffer save_buffer = 40;
|
||||
|
@ -79,6 +80,10 @@ message Envelope {
|
|||
|
||||
GetUsers get_users = 70;
|
||||
GetUsersResponse get_users_response = 71;
|
||||
|
||||
Follow follow = 72;
|
||||
FollowResponse follow_response = 73;
|
||||
UpdateFollower update_follower = 74;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -241,12 +246,17 @@ message OpenBufferForSymbolResponse {
|
|||
Buffer buffer = 1;
|
||||
}
|
||||
|
||||
message OpenBuffer {
|
||||
message OpenBufferByPath {
|
||||
uint64 project_id = 1;
|
||||
uint64 worktree_id = 2;
|
||||
string path = 3;
|
||||
}
|
||||
|
||||
message OpenBufferById {
|
||||
uint64 project_id = 1;
|
||||
uint64 id = 2;
|
||||
}
|
||||
|
||||
message OpenBufferResponse {
|
||||
Buffer buffer = 1;
|
||||
}
|
||||
|
@ -521,8 +531,49 @@ message UpdateContacts {
|
|||
repeated Contact contacts = 1;
|
||||
}
|
||||
|
||||
message UpdateDiagnostics {
|
||||
uint32 replica_id = 1;
|
||||
uint32 lamport_timestamp = 2;
|
||||
repeated Diagnostic diagnostics = 3;
|
||||
}
|
||||
|
||||
message Follow {}
|
||||
|
||||
message FollowResponse {
|
||||
uint64 current_view_id = 1;
|
||||
repeated View views = 2;
|
||||
}
|
||||
|
||||
message UpdateFollower {
|
||||
uint64 current_view_id = 1;
|
||||
repeated ViewUpdate view_updates = 2;
|
||||
}
|
||||
|
||||
// Entities
|
||||
|
||||
message View {
|
||||
uint64 id = 1;
|
||||
oneof variant {
|
||||
Editor editor = 2;
|
||||
}
|
||||
|
||||
message Editor {
|
||||
uint64 buffer_id = 1;
|
||||
Selection newest_selection = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ViewUpdate {
|
||||
uint64 id = 1;
|
||||
oneof variant {
|
||||
Editor editor = 2;
|
||||
}
|
||||
|
||||
message Editor {
|
||||
Selection newest_selection = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message Collaborator {
|
||||
uint32 peer_id = 1;
|
||||
uint32 replica_id = 2;
|
||||
|
@ -578,17 +629,6 @@ message BufferState {
|
|||
repeated string completion_triggers = 8;
|
||||
}
|
||||
|
||||
message BufferFragment {
|
||||
uint32 replica_id = 1;
|
||||
uint32 local_timestamp = 2;
|
||||
uint32 lamport_timestamp = 3;
|
||||
uint32 insertion_offset = 4;
|
||||
uint32 len = 5;
|
||||
bool visible = 6;
|
||||
repeated VectorClockEntry deletions = 7;
|
||||
repeated VectorClockEntry max_undos = 8;
|
||||
}
|
||||
|
||||
message SelectionSet {
|
||||
uint32 replica_id = 1;
|
||||
repeated Selection selections = 2;
|
||||
|
@ -614,12 +654,6 @@ enum Bias {
|
|||
Right = 1;
|
||||
}
|
||||
|
||||
message UpdateDiagnostics {
|
||||
uint32 replica_id = 1;
|
||||
uint32 lamport_timestamp = 2;
|
||||
repeated Diagnostic diagnostics = 3;
|
||||
}
|
||||
|
||||
message Diagnostic {
|
||||
Anchor start = 1;
|
||||
Anchor end = 2;
|
||||
|
|
|
@ -175,7 +175,8 @@ messages!(
|
|||
(UpdateLanguageServer, Foreground),
|
||||
(LeaveChannel, Foreground),
|
||||
(LeaveProject, Foreground),
|
||||
(OpenBuffer, Background),
|
||||
(OpenBufferById, Background),
|
||||
(OpenBufferByPath, Background),
|
||||
(OpenBufferForSymbol, Background),
|
||||
(OpenBufferForSymbolResponse, Background),
|
||||
(OpenBufferResponse, Background),
|
||||
|
@ -223,7 +224,8 @@ request_messages!(
|
|||
(GetUsers, GetUsersResponse),
|
||||
(JoinChannel, JoinChannelResponse),
|
||||
(JoinProject, JoinProjectResponse),
|
||||
(OpenBuffer, OpenBufferResponse),
|
||||
(OpenBufferById, OpenBufferResponse),
|
||||
(OpenBufferByPath, OpenBufferResponse),
|
||||
(OpenBufferForSymbol, OpenBufferForSymbolResponse),
|
||||
(Ping, Ack),
|
||||
(PerformRename, PerformRenameResponse),
|
||||
|
@ -255,7 +257,8 @@ entity_messages!(
|
|||
GetProjectSymbols,
|
||||
JoinProject,
|
||||
LeaveProject,
|
||||
OpenBuffer,
|
||||
OpenBufferById,
|
||||
OpenBufferByPath,
|
||||
OpenBufferForSymbol,
|
||||
PerformRename,
|
||||
PrepareRename,
|
||||
|
|
|
@ -92,7 +92,7 @@ impl Server {
|
|||
.add_request_handler(Server::forward_project_request::<proto::GetDocumentHighlights>)
|
||||
.add_request_handler(Server::forward_project_request::<proto::GetProjectSymbols>)
|
||||
.add_request_handler(Server::forward_project_request::<proto::OpenBufferForSymbol>)
|
||||
.add_request_handler(Server::forward_project_request::<proto::OpenBuffer>)
|
||||
.add_request_handler(Server::forward_project_request::<proto::OpenBufferByPath>)
|
||||
.add_request_handler(Server::forward_project_request::<proto::GetCompletions>)
|
||||
.add_request_handler(
|
||||
Server::forward_project_request::<proto::ApplyCompletionAdditionalEdits>,
|
||||
|
|
Loading…
Reference in a new issue