language: Make Buffer::new take an explicit ID (#2900)

See Linear description for the full explanation of the issue. This PR is
mostly a mechanical change, except for the one case where we do pass in
an explicit `next_id` instead of `model_id` in project.rs.

Release Notes:
- Fixed a bug where some results were not reported in project search in
presence of unnamed buffers.
This commit is contained in:
Piotr Osiewicz 2023-08-28 11:51:50 +02:00 committed by GitHub
parent 81a5043b61
commit 07b9c6c302
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 141 additions and 104 deletions

View file

@ -837,6 +837,7 @@ mod tests {
let buffer = cx.add_model(|cx| {
Buffer::new(
0,
cx.model_id() as u64,
r#"
A regular expression (shortened as regex or regexp;[1] also referred to as
rational expression[2][3]) is a sequence of characters that specifies a search
@ -844,7 +845,6 @@ mod tests {
for "find" or "find and replace" operations on strings, or for input validation.
"#
.unindent(),
cx,
)
});
let window = cx.add_window(|_| EmptyView);
@ -1225,7 +1225,7 @@ mod tests {
expected_query_matches_count > 1,
"Should pick a query with multiple results"
);
let buffer = cx.add_model(|cx| Buffer::new(0, buffer_text, cx));
let buffer = cx.add_model(|cx| Buffer::new(0, cx.model_id() as u64, buffer_text));
let window = cx.add_window(|_| EmptyView);
let editor = window.add_view(cx, |cx| Editor::for_buffer(buffer.clone(), None, cx));
@ -1412,7 +1412,7 @@ mod tests {
for "find" or "find and replace" operations on strings, or for input validation.
"#
.unindent();
let buffer = cx.add_model(|cx| Buffer::new(0, buffer_text, cx));
let buffer = cx.add_model(|cx| Buffer::new(0, cx.model_id() as u64, buffer_text));
let window = cx.add_window(|_| EmptyView);
let editor = window.add_view(cx, |cx| Editor::for_buffer(buffer.clone(), None, cx));