Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Quote fixes (#19765)
Conrad Irwin98d2e5fe7336
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rsindex 641ccc27151..d23889b4276 100644--- a/crates/editor/src/editor.rs+++ b/crates/editor/src/editor.rs@@ -3282,10 +3282,25 @@ impl Editor {&bracket_pair.start[..prefix_len],));+ let is_closing_quote = if bracket_pair.end == bracket_pair.start+ && bracket_pair.start.len() == 1+ {+ let target = bracket_pair.start.chars().next().unwrap();+ let current_line_count = snapshot+ .reversed_chars_at(selection.start)+ .take_while(|&c| c != '\n')+ .filter(|&c| c == target)+ .count();+ current_line_count % 2 == 1+ } else {+ false+ };+if autoclose&& bracket_pair.close&& following_text_allows_autoclose&& preceding_text_matches_prefix+ && !is_closing_quote{let anchor = snapshot.anchor_before(selection.end);new_selections.push((selection.map(|_| anchor), text.len()));diff --git a/crates/languages/src/rust/config.toml b/crates/languages/src/rust/config.tomlindex d01f62e354e..81b9c1e2d94 100644--- a/crates/languages/src/rust/config.toml+++ b/crates/languages/src/rust/config.toml@@ -5,6 +5,9 @@ line_comments = ["// ", "/// ", "//! "]autoclose_before = ";:.,=}])>"brackets = [{ start = "{", end = "}", close = true, newline = true },+ { start = "r#\"", end = "\"#", close = true, newline = true },+ { start = "r##\"", end = "\"##", close = true, newline = true },+ { start = "r###\"", end = "\"###", close = true, newline = true },{ start = "[", end = "]", close = true, newline = true },{ start = "(", end = ")", close = true, newline = true },{ start = "<", end = ">", close = false, newline = true, not_in = ["string", "comment"] },