search: Bump fancy-regex dependency and enable CRLF mode (#55471)

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #43396

Release Notes:

- Project search now supports CRLF line endings correctly, as well as
other regex features like subroutine calls
This commit is contained in:
Keith Hall authored and GitHub committed 2026-07-08 16:56:45 +00:00
1 parent 2eeb3e9f47
commit bfd21aa8dc
4 files changed
+32 -7

No files matched your search

Generated
+5 -5
View File
@@ -6465,9 +6465,9 @@ dependencies = [
[[package]]
name = "fancy-regex"
version = "0.17.0"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72cf461f865c862bb7dc573f643dd6a2b6842f7c30b07882b56bd148cc2761b8"
checksum = "e1e1dacd0d2082dfcf1351c4bdd566bbe89a2b263235a2b50058f1e130a47277"
dependencies = [
"bit-set 0.8.0",
"regex-automata",
@@ -14003,7 +14003,7 @@ dependencies = [
"dap",
"encoding_rs",
"extension",
"fancy-regex 0.17.0",
"fancy-regex 0.18.0",
"fs",
"futures 0.3.32",
"fuzzy",
@@ -15066,9 +15066,9 @@ dependencies = [
[[package]]
name = "regex-automata"
version = "0.4.13"
version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c"
checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"
dependencies = [
"aho-corasick",
"memchr",
+1 -1
View File
@@ -595,7 +595,7 @@ emojis = "0.6.1"
env_logger = "0.11"
encoding_rs = "0.8"
exec = "0.3.1"
fancy-regex = "0.17.0"
fancy-regex = "0.18.0"
fork = "0.4.0"
futures = "0.3.32"
futures-concurrency = "7.7.1"
+1
View File
@@ -251,6 +251,7 @@ impl SearchQuery {
let regex = RegexBuilder::new(&pattern)
.case_insensitive(!case_sensitive)
.crlf(true)
.build()?;
Ok(Self::Regex {
regex,
+25 -1
View File
@@ -1,3 +1,4 @@
use language::Buffer;
use project::search::SearchQuery;
use text::Rope;
use util::{
@@ -130,6 +131,30 @@ fn test_case_sensitive_pattern_items() {
);
}
#[gpui::test]
async fn test_multiline_regex_crlf(cx: &mut gpui::TestAppContext) {
let search_query = SearchQuery::regex(
"^hello$\r?\n",
false,
false,
false,
false,
Default::default(),
Default::default(),
false,
None,
)
.expect("Should be able to create a regex SearchQuery");
let text = Rope::from("hello\r\nworld\r\nhello\r\nworld");
let snapshot = cx
.update(|app| Buffer::build_snapshot(text, None, None, None, app))
.await;
let results = search_query.search(&snapshot, None).await;
assert_eq!(results, vec![0..7, 14..21]);
}
#[gpui::test]
async fn test_multiline_regex(cx: &mut gpui::TestAppContext) {
let search_query = SearchQuery::regex(
@@ -145,7 +170,6 @@ async fn test_multiline_regex(cx: &mut gpui::TestAppContext) {
)
.expect("Should be able to create a regex SearchQuery");
use language::Buffer;
let text = Rope::from("hello\nworld\nhello\nworld");
let snapshot = cx
.update(|app| Buffer::build_snapshot(text, None, None, None, app))