Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Merge branch 'main' into allow-following-outside-of-projects

Max Brunsfelda8b35eb8f51b
diff --cc crates/collab_ui/src/channel_view.rs
index 22e7d6637ce,e46d31ac199..1d9e409748e
--- a/crates/collab_ui/src/channel_view.rs
+++ b/crates/collab_ui/src/channel_view.rs
@@@ -1,12 -1,10 +1,12 @@@
use anyhow::{anyhow, Result};
- use call::ActiveCall;
+ use call::report_call_event_for_channel;
-use channel::{ChannelBuffer, ChannelBufferEvent, ChannelId};
-use client::proto;
-use clock::ReplicaId;
+use channel::{Channel, ChannelBuffer, ChannelBufferEvent, ChannelId};
+use client::{
+ proto::{self, PeerId},
+ Collaborator, ParticipantIndex,
+};
use collections::HashMap;
-use editor::Editor;
+use editor::{CollaborationHub, Editor};
use gpui::{
actions,
elements::{ChildView, Label},
diff --cc crates/editor/src/editor.rs
index 2e15dd3a929,0facf0d7911..ca19ad24cb7
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@@ -8566,29 -8600,31 +8605,52 @@@ impl Editor
self.handle_input(text, cx);
}
+
+ pub fn supports_inlay_hints(&self, cx: &AppContext) -> bool {
+ let Some(project) = self.project.as_ref() else {
+ return false;
+ };
+ let project = project.read(cx);
+
+ let mut supports = false;
+ self.buffer().read(cx).for_each_buffer(|buffer| {
+ if !supports {
+ supports = project
+ .language_servers_for_buffer(buffer.read(cx), cx)
+ .any(
+ |(_, server)| match server.capabilities().inlay_hint_provider {
+ Some(lsp::OneOf::Left(enabled)) => enabled,
+ Some(lsp::OneOf::Right(_)) => true,
+ None => false,
+ },
+ )
+ }
+ });
+ supports
+ }
}
+pub trait CollaborationHub {
+ fn collaborators<'a>(&self, cx: &'a AppContext) -> &'a HashMap<PeerId, Collaborator>;
+ fn user_participant_indices<'a>(
+ &self,
+ cx: &'a AppContext,
+ ) -> &'a HashMap<u64, ParticipantIndex>;
+}
+
+impl CollaborationHub for ModelHandle<Project> {
+ fn collaborators<'a>(&self, cx: &'a AppContext) -> &'a HashMap<PeerId, Collaborator> {
+ self.read(cx).collaborators()
+ }
+
+ fn user_participant_indices<'a>(
+ &self,
+ cx: &'a AppContext,
+ ) -> &'a HashMap<u64, ParticipantIndex> {
+ self.read(cx).user_store().read(cx).participant_indices()
+ }
+}
+
fn inlay_hint_settings(
location: Anchor,
snapshot: &MultiBufferSnapshot,