ely-mark: rustfmt the files R3.1 left unformatted
Formatting alone; cargo fmt --check failed on these six. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
256240c365
commit
d07f0ddb7c
6 files changed
+168
-56
No files matched your search
+69
-20
@@ -1,9 +1,6 @@
|
||||
//! Whether Git sees the file changed; ElyTree does the rest.
|
||||
|
||||
use std::{
|
||||
io,
|
||||
path::Path,
|
||||
};
|
||||
use std::{io, path::Path};
|
||||
|
||||
use ely_gpui_component::{primitives::Severity, shell::StatusBarItem};
|
||||
use ely_office::prelude::*;
|
||||
@@ -145,7 +142,10 @@ impl Desk {
|
||||
}
|
||||
let (this, file) = (this.clone(), file.clone());
|
||||
cx.spawn(async move |cx| {
|
||||
let opened = cx.background_executor().spawn(async move { ely_platform::apps::open(AppId::Tree, &[file]) }).await;
|
||||
let opened = cx
|
||||
.background_executor()
|
||||
.spawn(async move { ely_platform::apps::open(AppId::Tree, &[file]) })
|
||||
.await;
|
||||
if let Err(error) = opened {
|
||||
log::error!("mark: ElyTree did not open: {error}");
|
||||
cx.update(|cx| {
|
||||
@@ -176,7 +176,9 @@ mod tests {
|
||||
fn spaces_stay_and_broken_repositories_say_why() {
|
||||
let dir = tempfile::tempdir().expect("a temp dir");
|
||||
// Windows names end in no space.
|
||||
let repo = dir.path().join(if cfg!(windows) { "re po" } else { "repo " });
|
||||
let repo = dir
|
||||
.path()
|
||||
.join(if cfg!(windows) { "re po" } else { "repo " });
|
||||
std::fs::create_dir(&repo).expect("the folder");
|
||||
git(&repo, &["init", "-q"]);
|
||||
std::fs::write(repo.join("t.md"), "a").expect("a file");
|
||||
@@ -193,11 +195,28 @@ mod tests {
|
||||
let dir = tempfile::tempdir().expect("a temp dir");
|
||||
let repo = dir.path();
|
||||
git(repo, &["init", "-q"]);
|
||||
std::fs::write(repo.join(".gitignore"), "skip.md
|
||||
").expect("ignores");
|
||||
std::fs::write(
|
||||
repo.join(".gitignore"),
|
||||
"skip.md
|
||||
",
|
||||
)
|
||||
.expect("ignores");
|
||||
std::fs::write(repo.join("t.md"), "a").expect("a file");
|
||||
git(repo, &["add", "."]);
|
||||
git(repo, &["-c", "user.name=T", "-c", "user.email=t@t", "-c", "commit.gpgsign=false", "commit", "-qm", "one"]);
|
||||
git(
|
||||
repo,
|
||||
&[
|
||||
"-c",
|
||||
"user.name=T",
|
||||
"-c",
|
||||
"user.email=t@t",
|
||||
"-c",
|
||||
"commit.gpgsign=false",
|
||||
"commit",
|
||||
"-qm",
|
||||
"one",
|
||||
],
|
||||
);
|
||||
assert_eq!(ask(&repo.join("t.md")), Tracked::Unchanged);
|
||||
std::fs::write(repo.join("t.md"), "b").expect("an edit");
|
||||
assert_eq!(ask(&repo.join("t.md")), Tracked::Changed);
|
||||
@@ -208,30 +227,60 @@ mod tests {
|
||||
#[gpui::test]
|
||||
fn the_status_item_follows_a_save(cx: &mut gpui::TestAppContext) {
|
||||
use ely_office::prelude::*;
|
||||
let (data, dir) = (tempfile::tempdir().expect("data"), tempfile::tempdir().expect("repo"));
|
||||
let (data, dir) = (
|
||||
tempfile::tempdir().expect("data"),
|
||||
tempfile::tempdir().expect("repo"),
|
||||
);
|
||||
let repo = dir.path();
|
||||
git(repo, &["init", "-q"]);
|
||||
std::fs::write(repo.join("t.md"), "a
|
||||
").expect("a file");
|
||||
std::fs::write(
|
||||
repo.join("t.md"),
|
||||
"a
|
||||
",
|
||||
)
|
||||
.expect("a file");
|
||||
git(repo, &["add", "."]);
|
||||
git(repo, &["-c", "user.name=T", "-c", "user.email=t@t", "-c", "commit.gpgsign=false", "commit", "-qm", "one"]);
|
||||
git(
|
||||
repo,
|
||||
&[
|
||||
"-c",
|
||||
"user.name=T",
|
||||
"-c",
|
||||
"user.email=t@t",
|
||||
"-c",
|
||||
"commit.gpgsign=false",
|
||||
"commit",
|
||||
"-qm",
|
||||
"one",
|
||||
],
|
||||
);
|
||||
let (desk, cx) = crate::desk::tests::start(cx, data.path());
|
||||
crate::desk::tests::open(&desk, &repo.join("t.md"), cx);
|
||||
let said = |cx: &mut gpui::VisualTestContext| desk.read_with(cx, |desk, _| desk.tracked.clone());
|
||||
let said =
|
||||
|cx: &mut gpui::VisualTestContext| desk.read_with(cx, |desk, _| desk.tracked.clone());
|
||||
assert_eq!(said(cx), Some(Tracked::Unchanged));
|
||||
let (id, view) = desk.read_with(cx, |desk, _| {
|
||||
let tab = desk.active_tab().expect("a tab");
|
||||
(tab.id, tab.view.clone())
|
||||
});
|
||||
view.update(cx, |view, cx| view.adopt("b
|
||||
".into(), cx));
|
||||
cx.executor().advance_clock(std::time::Duration::from_secs(1));
|
||||
view.update(cx, |view, cx| {
|
||||
view.adopt(
|
||||
"b
|
||||
"
|
||||
.into(),
|
||||
cx,
|
||||
)
|
||||
});
|
||||
cx.executor()
|
||||
.advance_clock(std::time::Duration::from_secs(1));
|
||||
cx.run_until_parked();
|
||||
desk.update_in(cx, |desk, window, cx| desk.save(id, None, window, cx));
|
||||
cx.run_until_parked();
|
||||
assert_eq!(std::fs::read_to_string(repo.join("t.md")).expect("saved"), "b
|
||||
");
|
||||
assert_eq!(
|
||||
std::fs::read_to_string(repo.join("t.md")).expect("saved"),
|
||||
"b
|
||||
"
|
||||
);
|
||||
assert_eq!(said(cx), Some(Tracked::Changed));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user