sum_tree: Do not implement Dimension on tuples, use new Dimensions wrapper instead (#35482)

This is a bit of a readability improvement IMHO; I often find myself
confused when dealing when dimension pairs, as there's no easy way to
jump to the implementation of a dimension for tuples to remind myself
for the n-th time how exactly that impl works. Now it should be possible
to jump directly to that impl.

Another bonus is that Dimension supports 3-ary tuples as well - by using
a () as a default value of a 3rd dimension.


Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2025-08-05 02:37:22 +02:00 committed by GitHub
parent be2f54b233
commit 07e3d53d58
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 215 additions and 141 deletions

View file

@ -46,6 +46,7 @@ project.workspace = true
serde.workspace = true
serde_json.workspace = true
settings.workspace = true
sum_tree.workspace = true
task.workspace = true
ui.workspace = true
util.workspace = true

View file

@ -39,6 +39,7 @@ use std::{
path::{Path, PathBuf},
sync::Arc,
};
use sum_tree::Dimensions;
use util::{ResultExt, fs::remove_matching};
use workspace::Workspace;
@ -239,7 +240,7 @@ impl RegisteredBuffer {
let new_snapshot = new_snapshot.clone();
async move {
new_snapshot
.edits_since::<(PointUtf16, usize)>(&old_version)
.edits_since::<Dimensions<PointUtf16, usize>>(&old_version)
.map(|edit| {
let edit_start = edit.new.start.0;
let edit_end = edit_start + (edit.old.end.0 - edit.old.start.0);