Compare commits
8 Commits
update-wor
...
v0.136.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
761e471887 | ||
|
|
7088352ead | ||
|
|
6590115242 | ||
|
|
9503d5a234 | ||
|
|
bb1b177aff | ||
|
|
d5ff62cf3a | ||
|
|
c44d170cb1 | ||
|
|
dbe636ebe2 |
35
Cargo.lock
generated
35
Cargo.lock
generated
@@ -240,9 +240,9 @@ checksum = "e78f17bacc1bc7b91fef7b1885c10772eb2b9e4e989356f6f0f6a972240f97cd"
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.75"
|
||||
version = "1.0.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
|
||||
checksum = "25bdb32cbbdce2b519a9cd7df3a678443100e265d5e25ca763b7572a5104f5f3"
|
||||
|
||||
[[package]]
|
||||
name = "approx"
|
||||
@@ -1301,7 +1301,7 @@ checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"axum-core",
|
||||
"base64 0.21.4",
|
||||
"base64 0.21.7",
|
||||
"bitflags 1.3.2",
|
||||
"bytes 1.5.0",
|
||||
"futures-util",
|
||||
@@ -1396,9 +1396,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.21.4"
|
||||
version = "0.21.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2"
|
||||
checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
@@ -2412,7 +2412,6 @@ dependencies = [
|
||||
"call",
|
||||
"channel",
|
||||
"client",
|
||||
"clock",
|
||||
"collections",
|
||||
"db",
|
||||
"dev_server_projects",
|
||||
@@ -3836,9 +3835,9 @@ checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649"
|
||||
|
||||
[[package]]
|
||||
name = "fancy-regex"
|
||||
version = "0.11.0"
|
||||
version = "0.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b95f7c0680e4142284cf8b22c14a476e87d61b004a3a0861872b32ef7ead40a2"
|
||||
checksum = "7493d4c459da9f84325ad297371a6b2b8a162800873a22e3b6b6512e61d18c05"
|
||||
dependencies = [
|
||||
"bit-set",
|
||||
"regex",
|
||||
@@ -4854,7 +4853,7 @@ version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270"
|
||||
dependencies = [
|
||||
"base64 0.21.4",
|
||||
"base64 0.21.7",
|
||||
"bytes 1.5.0",
|
||||
"headers-core",
|
||||
"http 0.2.9",
|
||||
@@ -7384,7 +7383,7 @@ version = "1.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a4a0cfc5fb21a09dc6af4bf834cf10d4a32fccd9e2ea468c4b1751a097487aa"
|
||||
dependencies = [
|
||||
"base64 0.21.4",
|
||||
"base64 0.21.7",
|
||||
"indexmap 1.9.3",
|
||||
"line-wrap",
|
||||
"quick-xml 0.30.0",
|
||||
@@ -8184,7 +8183,7 @@ version = "0.11.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1"
|
||||
dependencies = [
|
||||
"base64 0.21.4",
|
||||
"base64 0.21.7",
|
||||
"bytes 1.5.0",
|
||||
"encoding_rs",
|
||||
"futures-core",
|
||||
@@ -8566,7 +8565,7 @@ version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2"
|
||||
dependencies = [
|
||||
"base64 0.21.4",
|
||||
"base64 0.21.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -9577,7 +9576,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "864b869fdf56263f4c95c45483191ea0af340f9f3e3e7b4d57a61c7c87a970db"
|
||||
dependencies = [
|
||||
"atoi",
|
||||
"base64 0.21.4",
|
||||
"base64 0.21.7",
|
||||
"bigdecimal",
|
||||
"bitflags 2.4.2",
|
||||
"byteorder",
|
||||
@@ -9624,7 +9623,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eb7ae0e6a97fb3ba33b23ac2671a5ce6e3cabe003f451abd5a56e7951d975624"
|
||||
dependencies = [
|
||||
"atoi",
|
||||
"base64 0.21.4",
|
||||
"base64 0.21.7",
|
||||
"bigdecimal",
|
||||
"bitflags 2.4.2",
|
||||
"byteorder",
|
||||
@@ -10346,12 +10345,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tiktoken-rs"
|
||||
version = "0.5.7"
|
||||
version = "0.5.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4427b6b1c6b38215b92dd47a83a0ecc6735573d0a5a4c14acc0ac5b33b28adb"
|
||||
checksum = "c314e7ce51440f9e8f5a497394682a57b7c323d0f4d0a6b1b13c429056e0e234"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64 0.21.4",
|
||||
"base64 0.21.7",
|
||||
"bstr",
|
||||
"fancy-regex",
|
||||
"lazy_static",
|
||||
@@ -12929,7 +12928,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zed"
|
||||
version = "0.136.0"
|
||||
version = "0.136.2"
|
||||
dependencies = [
|
||||
"activity_indicator",
|
||||
"anyhow",
|
||||
|
||||
@@ -337,7 +337,7 @@ subtle = "2.5.0"
|
||||
sysinfo = "0.30.7"
|
||||
tempfile = "3.9.0"
|
||||
thiserror = "1.0.29"
|
||||
tiktoken-rs = "0.5.7"
|
||||
tiktoken-rs = "0.5.9"
|
||||
time = { version = "0.3", features = [
|
||||
"macros",
|
||||
"parsing",
|
||||
|
||||
@@ -204,9 +204,7 @@ pub fn count_open_ai_tokens(
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
match request.model {
|
||||
LanguageModel::OpenAi(OpenAiModel::FourOmni)
|
||||
| LanguageModel::ZedDotDev(ZedDotDevModel::Gpt4Omni)
|
||||
| LanguageModel::Anthropic(_)
|
||||
LanguageModel::Anthropic(_)
|
||||
| LanguageModel::ZedDotDev(ZedDotDevModel::Claude3Opus)
|
||||
| LanguageModel::ZedDotDev(ZedDotDevModel::Claude3Sonnet)
|
||||
| LanguageModel::ZedDotDev(ZedDotDevModel::Claude3Haiku) => {
|
||||
|
||||
@@ -89,6 +89,7 @@ pub enum ContactRequestStatus {
|
||||
|
||||
pub struct UserStore {
|
||||
users: HashMap<u64, Arc<User>>,
|
||||
by_github_login: HashMap<String, u64>,
|
||||
participant_indices: HashMap<u64, ParticipantIndex>,
|
||||
update_contacts_tx: mpsc::UnboundedSender<UpdateContacts>,
|
||||
current_user: watch::Receiver<Option<Arc<User>>>,
|
||||
@@ -144,6 +145,7 @@ impl UserStore {
|
||||
];
|
||||
Self {
|
||||
users: Default::default(),
|
||||
by_github_login: Default::default(),
|
||||
current_user: current_user_rx,
|
||||
contacts: Default::default(),
|
||||
incoming_contact_requests: Default::default(),
|
||||
@@ -231,6 +233,7 @@ impl UserStore {
|
||||
#[cfg(feature = "test-support")]
|
||||
pub fn clear_cache(&mut self) {
|
||||
self.users.clear();
|
||||
self.by_github_login.clear();
|
||||
}
|
||||
|
||||
async fn handle_update_invite_info(
|
||||
@@ -644,6 +647,12 @@ impl UserStore {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn cached_user_by_github_login(&self, github_login: &str) -> Option<Arc<User>> {
|
||||
self.by_github_login
|
||||
.get(github_login)
|
||||
.and_then(|id| self.users.get(id).cloned())
|
||||
}
|
||||
|
||||
pub fn current_user(&self) -> Option<Arc<User>> {
|
||||
self.current_user.borrow().clone()
|
||||
}
|
||||
@@ -670,6 +679,8 @@ impl UserStore {
|
||||
this.update(&mut cx, |this, _| {
|
||||
for user in &users {
|
||||
this.users.insert(user.id, user.clone());
|
||||
this.by_github_login
|
||||
.insert(user.github_login.clone(), user.id);
|
||||
}
|
||||
})
|
||||
.ok();
|
||||
|
||||
@@ -34,7 +34,6 @@ auto_update.workspace = true
|
||||
call.workspace = true
|
||||
channel.workspace = true
|
||||
client.workspace = true
|
||||
clock.workspace = true
|
||||
collections.workspace = true
|
||||
db.workspace = true
|
||||
editor.workspace = true
|
||||
|
||||
@@ -78,12 +78,14 @@ impl ChatPanel {
|
||||
let fs = workspace.app_state().fs.clone();
|
||||
let client = workspace.app_state().client.clone();
|
||||
let channel_store = ChannelStore::global(cx);
|
||||
let user_store = workspace.app_state().user_store.clone();
|
||||
let languages = workspace.app_state().languages.clone();
|
||||
|
||||
let input_editor = cx.new_view(|cx| {
|
||||
MessageEditor::new(
|
||||
languages.clone(),
|
||||
channel_store.clone(),
|
||||
user_store.clone(),
|
||||
None,
|
||||
cx.new_view(|cx| Editor::auto_height(4, cx)),
|
||||
cx,
|
||||
)
|
||||
@@ -231,19 +233,12 @@ impl ChatPanel {
|
||||
|
||||
fn set_active_chat(&mut self, chat: Model<ChannelChat>, cx: &mut ViewContext<Self>) {
|
||||
if self.active_chat.as_ref().map(|e| &e.0) != Some(&chat) {
|
||||
let channel_id = chat.read(cx).channel_id;
|
||||
{
|
||||
self.markdown_data.clear();
|
||||
|
||||
let chat = chat.read(cx);
|
||||
let channel_name = chat.channel(cx).map(|channel| channel.name.clone());
|
||||
let message_count = chat.message_count();
|
||||
self.message_list.reset(message_count);
|
||||
self.message_editor.update(cx, |editor, cx| {
|
||||
editor.set_channel(channel_id, channel_name, cx);
|
||||
editor.clear_reply_to_message_id();
|
||||
});
|
||||
};
|
||||
self.markdown_data.clear();
|
||||
self.message_list.reset(chat.read(cx).message_count());
|
||||
self.message_editor.update(cx, |editor, cx| {
|
||||
editor.set_channel_chat(chat.clone(), cx);
|
||||
editor.clear_reply_to_message_id();
|
||||
});
|
||||
let subscription = cx.subscribe(&chat, Self::channel_did_change);
|
||||
self.active_chat = Some((chat, subscription));
|
||||
self.acknowledge_last_message(cx);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
use anyhow::Result;
|
||||
use channel::{ChannelMembership, ChannelStore, MessageParams};
|
||||
use client::{ChannelId, UserId};
|
||||
use collections::{HashMap, HashSet};
|
||||
use channel::{ChannelChat, ChannelStore, MessageParams};
|
||||
use client::{UserId, UserStore};
|
||||
use collections::HashSet;
|
||||
use editor::{AnchorRangeExt, CompletionProvider, Editor, EditorElement, EditorStyle};
|
||||
use fuzzy::{StringMatch, StringMatchCandidate};
|
||||
use gpui::{
|
||||
AsyncWindowContext, FocusableView, FontStyle, FontWeight, HighlightStyle, IntoElement, Model,
|
||||
Render, SharedString, Task, TextStyle, View, ViewContext, WeakView, WhiteSpace,
|
||||
Render, Task, TextStyle, View, ViewContext, WeakView, WhiteSpace,
|
||||
};
|
||||
use language::{
|
||||
language_settings::SoftWrap, Anchor, Buffer, BufferSnapshot, CodeLabel, LanguageRegistry,
|
||||
@@ -31,11 +31,10 @@ lazy_static! {
|
||||
|
||||
pub struct MessageEditor {
|
||||
pub editor: View<Editor>,
|
||||
channel_store: Model<ChannelStore>,
|
||||
channel_members: HashMap<String, UserId>,
|
||||
user_store: Model<UserStore>,
|
||||
channel_chat: Option<Model<ChannelChat>>,
|
||||
mentions: Vec<UserId>,
|
||||
mentions_task: Option<Task<()>>,
|
||||
channel_id: Option<ChannelId>,
|
||||
reply_to_message_id: Option<u64>,
|
||||
edit_message_id: Option<u64>,
|
||||
}
|
||||
@@ -81,7 +80,8 @@ impl CompletionProvider for MessageEditorCompletionProvider {
|
||||
impl MessageEditor {
|
||||
pub fn new(
|
||||
language_registry: Arc<LanguageRegistry>,
|
||||
channel_store: Model<ChannelStore>,
|
||||
user_store: Model<UserStore>,
|
||||
channel_chat: Option<Model<ChannelChat>>,
|
||||
editor: View<Editor>,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) -> Self {
|
||||
@@ -127,9 +127,8 @@ impl MessageEditor {
|
||||
|
||||
Self {
|
||||
editor,
|
||||
channel_store,
|
||||
channel_members: HashMap::default(),
|
||||
channel_id: None,
|
||||
user_store,
|
||||
channel_chat,
|
||||
mentions: Vec::new(),
|
||||
mentions_task: None,
|
||||
reply_to_message_id: None,
|
||||
@@ -161,12 +160,13 @@ impl MessageEditor {
|
||||
self.edit_message_id = None;
|
||||
}
|
||||
|
||||
pub fn set_channel(
|
||||
&mut self,
|
||||
channel_id: ChannelId,
|
||||
channel_name: Option<SharedString>,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) {
|
||||
pub fn set_channel_chat(&mut self, chat: Model<ChannelChat>, cx: &mut ViewContext<Self>) {
|
||||
let channel_id = chat.read(cx).channel_id;
|
||||
self.channel_chat = Some(chat);
|
||||
let channel_name = ChannelStore::global(cx)
|
||||
.read(cx)
|
||||
.channel_for_id(channel_id)
|
||||
.map(|channel| channel.name.clone());
|
||||
self.editor.update(cx, |editor, cx| {
|
||||
if let Some(channel_name) = channel_name {
|
||||
editor.set_placeholder_text(format!("Message #{channel_name}"), cx);
|
||||
@@ -174,31 +174,6 @@ impl MessageEditor {
|
||||
editor.set_placeholder_text("Message Channel", cx);
|
||||
}
|
||||
});
|
||||
self.channel_id = Some(channel_id);
|
||||
self.refresh_users(cx);
|
||||
}
|
||||
|
||||
pub fn refresh_users(&mut self, cx: &mut ViewContext<Self>) {
|
||||
if let Some(channel_id) = self.channel_id {
|
||||
let members = self.channel_store.update(cx, |store, cx| {
|
||||
store.get_channel_member_details(channel_id, cx)
|
||||
});
|
||||
cx.spawn(|this, mut cx| async move {
|
||||
let members = members.await?;
|
||||
this.update(&mut cx, |this, cx| this.set_members(members, cx))?;
|
||||
anyhow::Ok(())
|
||||
})
|
||||
.detach_and_log_err(cx);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_members(&mut self, members: Vec<ChannelMembership>, _: &mut ViewContext<Self>) {
|
||||
self.channel_members.clear();
|
||||
self.channel_members.extend(
|
||||
members
|
||||
.into_iter()
|
||||
.map(|member| (member.user.github_login.clone(), member.user.id)),
|
||||
);
|
||||
}
|
||||
|
||||
pub fn take_message(&mut self, cx: &mut ViewContext<Self>) -> MessageParams {
|
||||
@@ -368,13 +343,19 @@ impl MessageEditor {
|
||||
let start_anchor = buffer.read(cx).anchor_before(start_offset);
|
||||
|
||||
let mut names = HashSet::default();
|
||||
for (github_login, _) in self.channel_members.iter() {
|
||||
names.insert(github_login.clone());
|
||||
}
|
||||
if let Some(channel_id) = self.channel_id {
|
||||
for participant in self.channel_store.read(cx).channel_participants(channel_id) {
|
||||
if let Some(chat) = self.channel_chat.as_ref() {
|
||||
let chat = chat.read(cx);
|
||||
for participant in ChannelStore::global(cx)
|
||||
.read(cx)
|
||||
.channel_participants(chat.channel_id)
|
||||
{
|
||||
names.insert(participant.github_login.clone());
|
||||
}
|
||||
for message in chat
|
||||
.messages_in_range(chat.message_count().saturating_sub(100)..chat.message_count())
|
||||
{
|
||||
names.insert(message.sender.github_login.clone());
|
||||
}
|
||||
}
|
||||
|
||||
let candidates = names
|
||||
@@ -481,11 +462,15 @@ impl MessageEditor {
|
||||
text.clear();
|
||||
text.extend(buffer.text_for_range(range.clone()));
|
||||
if let Some(username) = text.strip_prefix('@') {
|
||||
if let Some(user_id) = this.channel_members.get(username) {
|
||||
if let Some(user) = this
|
||||
.user_store
|
||||
.read(cx)
|
||||
.cached_user_by_github_login(username)
|
||||
{
|
||||
let start = multi_buffer.anchor_after(range.start);
|
||||
let end = multi_buffer.anchor_after(range.end);
|
||||
|
||||
mentioned_user_ids.push(*user_id);
|
||||
mentioned_user_ids.push(user.id);
|
||||
anchor_ranges.push(start..end);
|
||||
}
|
||||
}
|
||||
@@ -550,106 +535,3 @@ impl Render for MessageEditor {
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use client::{Client, User, UserStore};
|
||||
use clock::FakeSystemClock;
|
||||
use gpui::TestAppContext;
|
||||
use http::FakeHttpClient;
|
||||
use language::{Language, LanguageConfig};
|
||||
use project::Project;
|
||||
use rpc::proto;
|
||||
use settings::SettingsStore;
|
||||
use util::test::marked_text_ranges;
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_message_editor(cx: &mut TestAppContext) {
|
||||
let language_registry = init_test(cx);
|
||||
|
||||
let (editor, cx) = cx.add_window_view(|cx| {
|
||||
MessageEditor::new(
|
||||
language_registry,
|
||||
ChannelStore::global(cx),
|
||||
cx.new_view(|cx| Editor::auto_height(4, cx)),
|
||||
cx,
|
||||
)
|
||||
});
|
||||
cx.executor().run_until_parked();
|
||||
|
||||
editor.update(cx, |editor, cx| {
|
||||
editor.set_members(
|
||||
vec![
|
||||
ChannelMembership {
|
||||
user: Arc::new(User {
|
||||
github_login: "a-b".into(),
|
||||
id: 101,
|
||||
avatar_uri: "avatar_a-b".into(),
|
||||
}),
|
||||
kind: proto::channel_member::Kind::Member,
|
||||
role: proto::ChannelRole::Member,
|
||||
},
|
||||
ChannelMembership {
|
||||
user: Arc::new(User {
|
||||
github_login: "C_D".into(),
|
||||
id: 102,
|
||||
avatar_uri: "avatar_C_D".into(),
|
||||
}),
|
||||
kind: proto::channel_member::Kind::Member,
|
||||
role: proto::ChannelRole::Member,
|
||||
},
|
||||
],
|
||||
cx,
|
||||
);
|
||||
|
||||
editor.editor.update(cx, |editor, cx| {
|
||||
editor.set_text("Hello, @a-b! Have you met @C_D?", cx)
|
||||
});
|
||||
});
|
||||
|
||||
cx.executor().advance_clock(MENTIONS_DEBOUNCE_INTERVAL);
|
||||
|
||||
editor.update(cx, |editor, cx| {
|
||||
let (text, ranges) = marked_text_ranges("Hello, «@a-b»! Have you met «@C_D»?", false);
|
||||
assert_eq!(
|
||||
editor.take_message(cx),
|
||||
MessageParams {
|
||||
text,
|
||||
mentions: vec![(ranges[0].clone(), 101), (ranges[1].clone(), 102)],
|
||||
reply_to_message_id: None
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
fn init_test(cx: &mut TestAppContext) -> Arc<LanguageRegistry> {
|
||||
cx.update(|cx| {
|
||||
let settings = SettingsStore::test(cx);
|
||||
cx.set_global(settings);
|
||||
|
||||
let clock = Arc::new(FakeSystemClock::default());
|
||||
let http = FakeHttpClient::with_404_response();
|
||||
let client = Client::new(clock, http.clone(), cx);
|
||||
let user_store = cx.new_model(|cx| UserStore::new(client.clone(), cx));
|
||||
theme::init(theme::LoadThemes::JustBase, cx);
|
||||
Project::init_settings(cx);
|
||||
language::init(cx);
|
||||
editor::init(cx);
|
||||
client::init(&client, cx);
|
||||
channel::init(&client, user_store, cx);
|
||||
|
||||
MessageEditorSettings::register(cx);
|
||||
});
|
||||
|
||||
let language_registry = Arc::new(LanguageRegistry::test(cx.executor()));
|
||||
language_registry.add(Arc::new(Language::new(
|
||||
LanguageConfig {
|
||||
name: "Markdown".into(),
|
||||
..Default::default()
|
||||
},
|
||||
Some(tree_sitter_markdown::language()),
|
||||
)));
|
||||
language_registry
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9927,6 +9927,10 @@ impl Editor {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn clear_search_within_ranges(&mut self, cx: &mut ViewContext<Self>) {
|
||||
self.clear_background_highlights::<SearchWithinRange>(cx);
|
||||
}
|
||||
|
||||
pub fn highlight_background<T: 'static>(
|
||||
&mut self,
|
||||
ranges: &[Range<Anchor>],
|
||||
|
||||
@@ -40,14 +40,10 @@ pub struct Popover {
|
||||
|
||||
impl RenderOnce for Popover {
|
||||
fn render(self, cx: &mut WindowContext) -> impl IntoElement {
|
||||
h_flex()
|
||||
.items_start()
|
||||
div()
|
||||
.flex()
|
||||
.gap_1()
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
.child(v_flex().elevation_2(cx).px_1().children(self.children)),
|
||||
)
|
||||
.child(v_flex().elevation_2(cx).px_1().children(self.children))
|
||||
.when_some(self.aside, |this, aside| {
|
||||
this.child(
|
||||
v_flex()
|
||||
|
||||
@@ -353,7 +353,6 @@ fn replace_command(
|
||||
let range = snapshot
|
||||
.anchor_before(Point::new(range.start.saturating_sub(1) as u32, 0))
|
||||
..snapshot.anchor_before(Point::new(range.end as u32, 0));
|
||||
|
||||
editor.set_search_within_ranges(&[range], cx)
|
||||
})
|
||||
}
|
||||
@@ -394,9 +393,7 @@ fn replace_command(
|
||||
.timer(Duration::from_millis(200))
|
||||
.await;
|
||||
editor
|
||||
.update(&mut cx, |editor, cx| {
|
||||
editor.set_search_within_ranges(&[], cx)
|
||||
})
|
||||
.update(&mut cx, |editor, cx| editor.clear_search_within_ranges(cx))
|
||||
.ok();
|
||||
})
|
||||
.detach();
|
||||
@@ -512,6 +509,8 @@ fn parse_replace_all(query: &str) -> Replacement {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use std::time::Duration;
|
||||
|
||||
use editor::{display_map::DisplayRow, DisplayPoint};
|
||||
use indoc::indoc;
|
||||
use search::BufferSearchBar;
|
||||
@@ -744,5 +743,19 @@ mod test {
|
||||
a
|
||||
"
|
||||
});
|
||||
cx.executor().advance_clock(Duration::from_millis(250));
|
||||
cx.run_until_parked();
|
||||
|
||||
cx.simulate_shared_keystrokes("/ a enter").await;
|
||||
cx.shared_state().await.assert_eq(indoc! {
|
||||
"a
|
||||
b
|
||||
b
|
||||
b
|
||||
b
|
||||
ˇa
|
||||
a
|
||||
"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,3 +10,7 @@
|
||||
{"Key":"b"}
|
||||
{"Key":"enter"}
|
||||
{"Get":{"state":"a\nb\nb\nb\nˇb\na\na\n ","mode":"Normal"}}
|
||||
{"Key":"/"}
|
||||
{"Key":"a"}
|
||||
{"Key":"enter"}
|
||||
{"Get":{"state":"a\nb\nb\nb\nb\nˇa\na\n ","mode":"Normal"}}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
description = "The fast, collaborative code editor."
|
||||
edition = "2021"
|
||||
name = "zed"
|
||||
version = "0.136.0"
|
||||
version = "0.136.2"
|
||||
publish = false
|
||||
license = "GPL-3.0-or-later"
|
||||
authors = ["Zed Team <hi@zed.dev>"]
|
||||
|
||||
@@ -1 +1 @@
|
||||
dev
|
||||
stable
|
||||
Reference in New Issue
Block a user