Compare commits

...

22 Commits

Author SHA1 Message Date
Zed Bot
3304200594 Bump to 0.133.6 for @ConradIrwin 2024-05-01 09:43:19 -07:00
Joseph T. Lyons
816417254b v0.133.x stable 2024-05-01 11:32:45 -04:00
gcp-cherry-pick-bot[bot]
71aa3255e6 Don't allow dropping files on remote projects (cherry-pick #11218) (#11225)
Cherry-picked Don't allow dropping files on remote projects (#11218)

Release Notes:

- Fixed a panic when a remote participant dropped a local file on your
project

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-04-30 14:36:39 -06:00
Zed Bot
07fd6d903f Bump to 0.133.5 for @ConradIrwin 2024-04-29 19:26:18 -07:00
gcp-cherry-pick-bot[bot]
6299c62d52 Fix panic in SVG rendering (cherry-pick #11196) (#11198)
Cherry-picked Fix panic in SVG rendering (#11196)

Release Notes:

- Fixed a panic in SVG rendering

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-04-29 19:38:22 -06:00
gcp-cherry-pick-bot[bot]
6b64abfed8 Validate buffer_id of anchors in is_valid (cherry-pick #11170) (#11172)
Cherry-picked Validate buffer_id of anchors in is_valid (#11170)

Release Notes:

- Fixes diagnostic panic better (follow up from #11066)

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-04-29 10:42:54 -06:00
Bennet Bo Fenner
5929bc3a2a zed 0.133.4 2024-04-29 16:11:43 +02:00
gcp-cherry-pick-bot[bot]
56e507a7c1 Fix relative line numbers (cherry-pick #11161) (#11164)
Cherry-picked Fix relative line numbers (#11161)

Closes #11105

Release Notes:

- Fixed rendering of relative line numbers in editor
([#11105](https://github.com/zed-industries/zed/issues/11105)).

Co-authored-by: Thorsten <thorsten@zed.dev>

Co-authored-by: Bennet Bo Fenner <53836821+bennetbo@users.noreply.github.com>
Co-authored-by: Thorsten <thorsten@zed.dev>
2024-04-29 16:09:00 +02:00
gcp-cherry-pick-bot[bot]
ea46e542be release notes vN (cherry-pick #11077) (#11079)
Cherry-picked release notes vN (#11077)

Make it more likely the draft release notes work...

Release Notes:

- N/A

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-04-26 18:10:39 -06:00
Max Brunsfeld
7b33de30a9 Don't panic when a tree-sitter parse fails (#11076)
Fixes
https://zed-industries.slack.com/archives/C04S6T1T7TQ/p1714162894982749

Release Notes:
* Fixed a crash that could happen if an error occurred in a parser
provided by an extension.

Co-authored-by: Conrad <conrad@zed.dev>
2024-04-26 17:16:14 -06:00
Zed Bot
f6c7d03357 Bump to 0.133.3 for @ConradIrwin 2024-04-26 14:35:01 -07:00
gcp-cherry-pick-bot[bot]
d7e3b79243 Fix panic in Diagnostics (cherry-pick #11066) (#11068)
Cherry-picked Fix panic in Diagnostics (#11066)

cc @maxbrunsfeld

Release Notes:

- Fixed a panic in populating diagnostics

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-04-26 14:17:56 -06:00
gcp-cherry-pick-bot[bot]
7a0f039414 Fix panic in rename selections (cherry-pick #11033) (#11034)
Cherry-picked Fix panic in rename selections (#11033)

cc @someonetoignore

Release Notes:

- Fixed a panic when renaming with a selection (preview only)

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-04-25 23:21:02 -06:00
gcp-cherry-pick-bot[bot]
e8ea7cfc88 Fix panic in vim search (cherry-pick #11022) (#11030)
Cherry-picked Fix panic in vim search (#11022)

Release Notes:

- vim: Fixed a panic when searching

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2024-04-25 20:45:19 -06:00
Zed Bot
759c3417d0 Bump to 0.133.2 for @maxdeviant 2024-04-25 06:33:36 -07:00
gcp-cherry-pick-bot[bot]
09c37027ce Revert "Changed cmd+w with no open tabs to close window (#10740)" (cherry-pick #10986) (#10988)
Cherry-picked Revert "Changed cmd+w with no open tabs to close window
(#10740)" (#10986)

This PR reverts #10740, as it makes it too easy to close Zed
accidentally.

Quitting Zed when you don't mean to is disruptive and can break your
flow. This is even more the case when you're collaborating.

Therefore, we shouldn't make it easy to quit Zed when you don't mean to.

If we want to bring back this behavior it needs to have a corresponding
setting that should, in my opinion, be **off** by default. Additionally,
someone made the good point that this behavior should not be present on
Linux or Windows.

This reverts commit 5102e37a5b.

Release Notes:

- Changed `cmd-w` with no open tabs to no longer close the window
(preview-only).

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-04-25 09:27:07 -04:00
Marshall Bowers
26c5f035c6 Ignore errors drafting release notes 2024-04-24 18:31:39 -04:00
Marshall Bowers
fedb2aa949 Try fetch-depth: 25 2024-04-24 18:19:59 -04:00
Marshall Bowers
de4e77c380 Try fetching tags 2024-04-24 18:12:46 -04:00
Zed Bot
99007ab26f Bump to 0.133.1 for @maxdeviant 2024-04-24 14:54:49 -07:00
gcp-cherry-pick-bot[bot]
f9e59f0213 Restore the previous styles for single-line editors (cherry-pick #10951) (#10952)
Cherry-picked Restore the previous styles for single-line editors
(#10951)

This PR fixes a bug introduced in #10870 that caused editors used as
single-line inputs to have the wrong text style.

If this change was intentional for something relating to the new
Assistant panel, we'll need to figure out a way to change it without
breaking these other usages.

### Before

<img width="589" alt="Screenshot 2024-04-24 at 5 35 36 PM"

src="https://github.com/zed-industries/zed/assets/1486634/31624cfd-75d1-4771-9402-c14ef9e9483e">

<img width="326" alt="Screenshot 2024-04-24 at 5 35 46 PM"

src="https://github.com/zed-industries/zed/assets/1486634/1b76a3ef-7205-49ee-b391-7609f90461bd">

### After

<img width="588" alt="Screenshot 2024-04-24 at 5 36 14 PM"

src="https://github.com/zed-industries/zed/assets/1486634/9d550ee2-80c0-4afb-9b45-a2956471c546">

<img width="260" alt="Screenshot 2024-04-24 at 5 36 31 PM"

src="https://github.com/zed-industries/zed/assets/1486634/63240f27-1679-45d5-b39c-016860ff9683">

Release Notes:

- Fixed a bug where some inputs were using the wrong font style
(preview-only).

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-04-24 17:54:12 -04:00
Joseph T. Lyons
0689ef4369 v0.133.x preview 2024-04-24 12:46:14 -04:00
15 changed files with 151 additions and 55 deletions

View File

@@ -173,6 +173,11 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4
with:
# We need to fetch more than one commit so that `script/draft-release-notes`
# is able to diff between the current and previous tag.
#
# 25 was chosen arbitrarily.
fetch-depth: 25
clean: false
submodules: "recursive"
@@ -206,7 +211,8 @@ jobs:
exit 1
fi
mkdir -p target/
script/draft-release-notes "$version" "$channel" > target/release-notes.md
# Ignore any errors that occur while drafting release notes to not fail the build.
script/draft-release-notes "$version" "$channel" > target/release-notes.md || true
- name: Generate license file
run: script/generate-licenses

8
Cargo.lock generated
View File

@@ -5963,9 +5963,9 @@ dependencies = [
[[package]]
name = "memchr"
version = "2.6.3"
version = "2.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c"
checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
[[package]]
name = "memfd"
@@ -10519,7 +10519,7 @@ dependencies = [
[[package]]
name = "tree-sitter"
version = "0.20.100"
source = "git+https://github.com/tree-sitter/tree-sitter?rev=7f21c3b98c0749ac192da67a0d65dfe3eabc4a63#7f21c3b98c0749ac192da67a0d65dfe3eabc4a63"
source = "git+https://github.com/tree-sitter/tree-sitter?rev=7b4894ba2ae81b988846676f54c0988d4027ef4f#7b4894ba2ae81b988846676f54c0988d4027ef4f"
dependencies = [
"cc",
"regex",
@@ -12607,7 +12607,7 @@ dependencies = [
[[package]]
name = "zed"
version = "0.133.0"
version = "0.133.6"
dependencies = [
"activity_indicator",
"anyhow",

View File

@@ -407,7 +407,7 @@ features = [
]
[patch.crates-io]
tree-sitter = { git = "https://github.com/tree-sitter/tree-sitter", rev = "7f21c3b98c0749ac192da67a0d65dfe3eabc4a63" }
tree-sitter = { git = "https://github.com/tree-sitter/tree-sitter", rev = "7b4894ba2ae81b988846676f54c0988d4027ef4f" }
# Workaround for a broken nightly build of gpui: See #7644 and revisit once 0.5.3 is released.
pathfinder_simd = { git = "https://github.com/servo/pathfinder.git", rev = "30419d07660dc11a21e42ef4a7fa329600cff152" }

View File

@@ -887,22 +887,27 @@ fn diagnostic_header_renderer(diagnostic: Diagnostic) -> RenderBlock {
})
}
fn compare_diagnostics<L: language::ToOffset, R: language::ToOffset>(
lhs: &DiagnosticEntry<L>,
rhs: &DiagnosticEntry<R>,
fn compare_diagnostics(
old: &DiagnosticEntry<language::Anchor>,
new: &DiagnosticEntry<language::Anchor>,
snapshot: &language::BufferSnapshot,
) -> Ordering {
lhs.range
use language::ToOffset;
// The old diagnostics may point to a previously open Buffer for this file.
if !old.range.start.is_valid(snapshot) {
return Ordering::Greater;
}
old.range
.start
.to_offset(snapshot)
.cmp(&rhs.range.start.to_offset(snapshot))
.cmp(&new.range.start.to_offset(snapshot))
.then_with(|| {
lhs.range
old.range
.end
.to_offset(snapshot)
.cmp(&rhs.range.end.to_offset(snapshot))
.cmp(&new.range.end.to_offset(snapshot))
})
.then_with(|| lhs.diagnostic.message.cmp(&rhs.diagnostic.message))
.then_with(|| old.diagnostic.message.cmp(&new.diagnostic.message))
}
#[cfg(test)]

View File

@@ -8200,9 +8200,13 @@ impl Editor {
cursor_offset_in_rename_range_end..cursor_offset_in_rename_range
}
};
editor.change_selections(Some(Autoscroll::fit()), cx, |s| {
s.select_ranges([rename_selection_range]);
});
if rename_selection_range.end > old_name.len() {
editor.select_all(&SelectAll, cx);
} else {
editor.change_selections(Some(Autoscroll::fit()), cx, |s| {
s.select_ranges([rename_selection_range]);
});
}
editor
});
@@ -10323,7 +10327,19 @@ impl Render for Editor {
let settings = ThemeSettings::get_global(cx);
let text_style = match self.mode {
EditorMode::SingleLine | EditorMode::AutoHeight { .. } => cx.text_style(),
EditorMode::SingleLine | EditorMode::AutoHeight { .. } => TextStyle {
color: cx.theme().colors().editor_foreground,
font_family: settings.ui_font.family.clone(),
font_features: settings.ui_font.features,
font_size: rems(0.875).into(),
font_weight: FontWeight::NORMAL,
font_style: FontStyle::Normal,
line_height: relative(settings.buffer_line_height.value()),
background_color: None,
underline: None,
strikethrough: None,
white_space: WhiteSpace::Normal,
},
EditorMode::Full => TextStyle {
color: cx.theme().colors().editor_foreground,
font_family: settings.buffer_font.family.clone(),

View File

@@ -1323,7 +1323,7 @@ impl EditorElement {
fn calculate_relative_line_numbers(
&self,
buffer_rows: Vec<Option<u32>>,
snapshot: &EditorSnapshot,
rows: &Range<u32>,
relative_to: Option<u32>,
) -> HashMap<u32, u32> {
@@ -1333,6 +1333,12 @@ impl EditorElement {
};
let start = rows.start.min(relative_to);
let end = rows.end.max(relative_to);
let buffer_rows = snapshot
.buffer_rows(start)
.take(1 + (end - start) as usize)
.collect::<Vec<_>>();
let head_idx = relative_to - start;
let mut delta = 1;
@@ -1407,9 +1413,7 @@ impl EditorElement {
None
};
let buffer_rows = buffer_rows.collect::<Vec<_>>();
let relative_rows =
self.calculate_relative_line_numbers(buffer_rows.clone(), &rows, relative_to);
let relative_rows = self.calculate_relative_line_numbers(snapshot, &rows, relative_to);
for (ix, row) in buffer_rows.into_iter().enumerate() {
let display_row = rows.start + ix as u32;
@@ -4453,8 +4457,12 @@ mod tests {
.unwrap();
assert_eq!(layouts.len(), 6);
let relative_rows =
element.calculate_relative_line_numbers((0..6).map(Some).collect(), &(0..6), Some(3));
let relative_rows = window
.update(cx, |editor, cx| {
let snapshot = editor.snapshot(cx);
element.calculate_relative_line_numbers(&snapshot, &(0..6), Some(3))
})
.unwrap();
assert_eq!(relative_rows[&0], 3);
assert_eq!(relative_rows[&1], 2);
assert_eq!(relative_rows[&2], 1);
@@ -4463,16 +4471,24 @@ mod tests {
assert_eq!(relative_rows[&5], 2);
// works if cursor is before screen
let relative_rows =
element.calculate_relative_line_numbers((0..6).map(Some).collect(), &(3..6), Some(1));
let relative_rows = window
.update(cx, |editor, cx| {
let snapshot = editor.snapshot(cx);
element.calculate_relative_line_numbers(&snapshot, &(3..6), Some(1))
})
.unwrap();
assert_eq!(relative_rows.len(), 3);
assert_eq!(relative_rows[&3], 2);
assert_eq!(relative_rows[&4], 3);
assert_eq!(relative_rows[&5], 4);
// works if cursor is after screen
let relative_rows =
element.calculate_relative_line_numbers((0..6).map(Some).collect(), &(0..3), Some(6));
let relative_rows = window
.update(cx, |editor, cx| {
let snapshot = editor.snapshot(cx);
element.calculate_relative_line_numbers(&snapshot, &(0..3), Some(6))
})
.unwrap();
assert_eq!(relative_rows.len(), 3);
assert_eq!(relative_rows[&0], 5);
assert_eq!(relative_rows[&1], 4);

View File

@@ -55,11 +55,12 @@ impl SvgRenderer {
};
// Render the SVG to a pixmap with the specified width and height.
let mut pixmap =
resvg::tiny_skia::Pixmap::new(size.width.into(), size.height.into()).unwrap();
let mut pixmap = resvg::tiny_skia::Pixmap::new(size.width.into(), size.height.into())
.ok_or(usvg::Error::InvalidSize)?;
let transform = tree.view_box().to_transform(
resvg::tiny_skia::Size::from_wh(size.width.0 as f32, size.height.0 as f32).unwrap(),
resvg::tiny_skia::Size::from_wh(size.width.0 as f32, size.height.0 as f32)
.ok_or(usvg::Error::InvalidSize)?,
);
resvg::render(&tree, transform, &mut pixmap.as_mut());

View File

@@ -606,13 +606,21 @@ impl SyntaxSnapshot {
LogIncludedRanges(&included_ranges),
);
tree = parse_text(
let result = parse_text(
grammar,
text.as_rope(),
step_start_byte,
included_ranges,
Some(old_tree.clone()),
);
match result {
Ok(t) => tree = t,
Err(e) => {
log::error!("error parsing text: {:?}", e);
continue;
}
};
changed_ranges = join_ranges(
invalidated_ranges
.iter()
@@ -651,13 +659,20 @@ impl SyntaxSnapshot {
LogIncludedRanges(&included_ranges),
);
tree = parse_text(
let result = parse_text(
grammar,
text.as_rope(),
step_start_byte,
included_ranges,
None,
);
match result {
Ok(t) => tree = t,
Err(e) => {
log::error!("error parsing text: {:?}", e);
continue;
}
};
changed_ranges = vec![step_start_byte..step_end_byte];
}
@@ -1161,16 +1176,12 @@ fn parse_text(
start_byte: usize,
ranges: Vec<tree_sitter::Range>,
old_tree: Option<Tree>,
) -> Tree {
) -> anyhow::Result<Tree> {
PARSER.with(|parser| {
let mut parser = parser.borrow_mut();
let mut chunks = text.chunks_in_range(start_byte..text.len());
parser
.set_included_ranges(&ranges)
.expect("overlapping ranges");
parser
.set_language(&grammar.ts_language)
.expect("incompatible grammar");
parser.set_included_ranges(&ranges)?;
parser.set_language(&grammar.ts_language)?;
parser
.parse_with(
&mut move |offset, _| {
@@ -1179,7 +1190,7 @@ fn parse_text(
},
old_tree.as_ref(),
)
.expect("invalid language")
.ok_or_else(|| anyhow::anyhow!("failed to parse"))
})
}

View File

@@ -8457,11 +8457,13 @@ impl Project {
OpenBuffer::Weak(_) => {}
},
hash_map::Entry::Vacant(e) => {
assert!(
is_remote,
"received buffer update from {:?}",
envelope.original_sender_id
);
if !is_remote {
debug_panic!(
"received buffer update from {:?}",
envelope.original_sender_id
);
return Err(anyhow!("received buffer update for non-remote project"));
}
e.insert(OpenBuffer::Operations(ops));
}
}

View File

@@ -97,6 +97,8 @@ impl Anchor {
pub fn is_valid(&self, buffer: &BufferSnapshot) -> bool {
if *self == Anchor::MIN || *self == Anchor::MAX {
true
} else if self.buffer_id != Some(buffer.remote_id) {
false
} else {
let fragment_id = buffer.fragment_id_for_anchor(self);
let mut fragment_cursor = buffer.fragments.cursor::<(Option<&Locator>, usize)>();

View File

@@ -159,11 +159,21 @@ fn search_submit(workspace: &mut Workspace, _: &SearchSubmit, cx: &mut ViewConte
search_bar.select_match(direction, count, cx);
search_bar.focus_editor(&Default::default(), cx);
let prior_selections = state.prior_selections.drain(..).collect();
let mut prior_selections: Vec<_> = state.prior_selections.drain(..).collect();
let prior_mode = state.prior_mode;
let prior_operator = state.prior_operator.take();
let new_selections = vim.editor_selections(cx);
// If the active editor has changed during a search, don't panic.
if prior_selections.iter().any(|s| {
vim.update_active_editor(cx, |_vim, editor, cx| {
!s.start.is_valid(&editor.snapshot(cx).buffer_snapshot)
})
.unwrap_or(true)
}) {
prior_selections.clear();
}
if prior_mode != vim.state().mode {
vim.switch_mode(prior_mode, true, cx);
}

View File

@@ -5,7 +5,7 @@ use crate::{
},
toolbar::Toolbar,
workspace_settings::{AutosaveSetting, TabBarSettings, WorkspaceSettings},
CloseWindow, NewCenterTerminal, NewFile, NewSearch, OpenInTerminal, OpenTerminal, OpenVisible,
NewCenterTerminal, NewFile, NewSearch, OpenInTerminal, OpenTerminal, OpenVisible,
SplitDirection, ToggleZoom, Workspace,
};
use anyhow::Result;
@@ -879,8 +879,6 @@ impl Pane {
cx: &mut ViewContext<Self>,
) -> Option<Task<Result<()>>> {
if self.items.is_empty() {
// Close the window when there's no active items to close.
cx.dispatch_action(Box::new(CloseWindow));
return None;
}
let active_item_id = self.items[self.active_item_index].item_id();
@@ -1889,6 +1887,24 @@ impl Pane {
let mut to_pane = cx.view().clone();
let mut split_direction = self.drag_split_direction;
let paths = paths.paths().to_vec();
let is_remote = self
.workspace
.update(cx, |workspace, cx| {
if workspace.project().read(cx).is_remote() {
workspace.show_error(
&anyhow::anyhow!("Cannot drop files on a remote project"),
cx,
);
true
} else {
false
}
})
.unwrap_or(true);
if is_remote {
return;
}
self.workspace
.update(cx, |workspace, cx| {
let fs = Arc::clone(workspace.project().read(cx).fs());

View File

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

View File

@@ -1 +1 @@
dev
stable

View File

@@ -27,13 +27,18 @@ async function main() {
if (parts[2] == 0) {
priorVersion = [parts[0], parts[1] - 1, 0].join(".");
}
} else if (!tagExists("v${priorVersion}")) {
} else if (!ensureTag(`v${priorVersion}`)) {
console.log("Copy the release notes from preview.");
process.exit(0);
}
let [tag, priorTag] = [`v${version}${suffix}`, `v${priorVersion}${suffix}`];
if (!ensureTag(tag) || !ensureTag(priorTag)) {
console.log("Could not draft release notes, missing a tag:", tag, priorTag);
process.exit(0);
}
const newCommits = getCommits(priorTag, tag);
let releaseNotes = [];
@@ -99,11 +104,17 @@ function getCommits(oldTag, newTag) {
return pullRequestNumbers;
}
function tagExists(tag) {
function ensureTag(tag) {
try {
execFileSync("git", ["rev-parse", "--verify", tag]);
return true;
} catch (e) {
return false;
try {
execFileSync("git"[("fetch", "origin", "--shallow-exclude", tag)]);
execFileSync("git"[("fetch", "origin", "--deepen", "1")]);
return true;
} catch (e) {
return false;
}
}
}