Compare commits

...

5 Commits

Author SHA1 Message Date
Zed Bot
258fb338bd Bump to 0.165.2 for @osiewicz 2024-12-05 12:54:47 +00:00
gcp-cherry-pick-bot[bot]
6ac691b3e9 Fix snippet completion will be trigger, when certain symbols are pressed (cherry-pick #21578) (#21585)
Cherry-picked Fix snippet completion will be trigger, when certain
symbols are pressed (#21578)

Closes #21576

This issue is caused by the fuzzy matching for snippets I added
[here](https://github.com/zed-industries/zed/pull/21524). When
encountering symbols such as `:`, `(`, `.`, etc., the `last_word`
becomes empty, which results in an empty string being passed to
`fuzzy_match`, leading to the return of all templates.

This fix adds an early return when `last_word` is empty.

Release Notes:

- N/A

Co-authored-by: tims <0xtimsb@gmail.com>
2024-12-05 13:28:43 +01:00
Zed Bot
7cd2f71392 Bump to 0.165.1 for @cole-miller 2024-12-05 02:41:13 +00:00
gcp-cherry-pick-bot[bot]
771ee7a9f6 Revert "Open folds containing selections when jumping from multibuffer (#21433)" (cherry-pick #21566) (#21569)
Cherry-picked Revert "Open folds containing selections when jumping from
multibuffer (#21433)" (#21566)

This reverts commit dc32ab25a0.

This has been causing panics, backing it out while figuring out what's
up.

Release Notes:

- N/A

Co-authored-by: Cole Miller <cole@zed.dev>
2024-12-04 21:32:43 -05:00
Peter Tripp
14c0a9d587 v0.165.x preview 2024-12-04 12:01:03 -05:00
5 changed files with 9 additions and 73 deletions

2
Cargo.lock generated
View File

@@ -15594,7 +15594,7 @@ dependencies = [
[[package]]
name = "zed"
version = "0.165.0"
version = "0.165.2"
dependencies = [
"activity_indicator",
"anyhow",

View File

@@ -12901,7 +12901,6 @@ impl Editor {
None => Autoscroll::newest(),
};
let nav_history = editor.nav_history.take();
editor.unfold_ranges(&ranges, false, true, cx);
editor.change_selections(Some(autoscroll), cx, |s| {
s.select_ranges(ranges);
});
@@ -13836,6 +13835,11 @@ fn snippet_completions(
.take_while(|c| classifier.is_word(*c))
.collect::<String>();
last_word = last_word.chars().rev().collect();
if last_word.is_empty() {
return Ok(vec![]);
}
let as_offset = text::ToOffset::to_offset(&buffer_position, &snapshot);
let to_lsp = |point: &text::Anchor| {
let end = text::ToPointUtf16::to_point_utf16(point, &snapshot);

View File

@@ -11567,7 +11567,7 @@ async fn test_multibuffer_reverts(cx: &mut gpui::TestAppContext) {
}
#[gpui::test]
async fn test_multibuffer_in_navigation_history(cx: &mut gpui::TestAppContext) {
async fn test_mutlibuffer_in_navigation_history(cx: &mut gpui::TestAppContext) {
init_test(cx, |_| {});
let cols = 4;
@@ -11856,74 +11856,6 @@ async fn test_multibuffer_in_navigation_history(cx: &mut gpui::TestAppContext) {
.unwrap();
}
#[gpui::test]
async fn test_multibuffer_unfold_on_jump(cx: &mut gpui::TestAppContext) {
init_test(cx, |_| {});
let texts = ["{\n\tx\n}".to_owned(), "y".to_owned()];
let buffers = texts
.clone()
.map(|txt| cx.new_model(|cx| Buffer::local(txt, cx)));
let multi_buffer = cx.new_model(|cx| {
let mut multi_buffer = MultiBuffer::new(ReadWrite);
for i in 0..2 {
multi_buffer.push_excerpts(
buffers[i].clone(),
[ExcerptRange {
context: 0..texts[i].len(),
primary: None,
}],
cx,
);
}
multi_buffer
});
let fs = FakeFs::new(cx.executor());
fs.insert_tree(
"/project",
json!({
"x": &texts[0],
"y": &texts[1],
}),
)
.await;
let project = Project::test(fs, ["/project".as_ref()], cx).await;
let workspace = cx.add_window(|cx| Workspace::test_new(project.clone(), cx));
let cx = &mut VisualTestContext::from_window(*workspace.deref(), cx);
let multi_buffer_editor = cx.new_view(|cx| {
Editor::for_multibuffer(multi_buffer.clone(), Some(project.clone()), true, cx)
});
let buffer_editor =
cx.new_view(|cx| Editor::for_buffer(buffers[0].clone(), Some(project.clone()), cx));
workspace
.update(cx, |workspace, cx| {
workspace.add_item_to_active_pane(
Box::new(multi_buffer_editor.clone()),
None,
true,
cx,
);
workspace.add_item_to_active_pane(Box::new(buffer_editor.clone()), None, false, cx);
})
.unwrap();
cx.executor().run_until_parked();
buffer_editor.update(cx, |buffer_editor, cx| {
buffer_editor.fold_at_level(&FoldAtLevel { level: 1 }, cx);
assert!(buffer_editor.snapshot(cx).fold_count() == 1);
});
cx.executor().run_until_parked();
multi_buffer_editor.update(cx, |multi_buffer_editor, cx| {
multi_buffer_editor.change_selections(None, cx, |s| s.select_ranges([3..4]));
multi_buffer_editor.open_excerpts(&OpenExcerpts, cx);
});
cx.executor().run_until_parked();
buffer_editor.update(cx, |buffer_editor, cx| {
assert!(buffer_editor.snapshot(cx).fold_count() == 0);
});
}
#[gpui::test]
async fn test_toggle_hunk_diff(executor: BackgroundExecutor, cx: &mut gpui::TestAppContext) {
init_test(cx, |_| {});

View File

@@ -2,7 +2,7 @@
description = "The fast, collaborative code editor."
edition = "2021"
name = "zed"
version = "0.165.0"
version = "0.165.2"
publish = false
license = "GPL-3.0-or-later"
authors = ["Zed Team <hi@zed.dev>"]

View File

@@ -1 +1 @@
dev
preview