Pass the 'Save' format trigger when formatting on save
In an earlier refactor, I accidentally caused the 'Manual' trigger to *always* be passed. Co-authored-by: Mikayla Maki <mikayla@zed.dev>
This commit is contained in:
parent
0704d9dcdb
commit
5fea49e639
3 changed files with 11 additions and 8 deletions
|
@ -4193,7 +4193,9 @@ async fn test_document_format_manual_trigger(cx: &mut gpui::TestAppContext) {
|
|||
let (_, editor) = cx.add_window(|cx| build_editor(buffer, cx));
|
||||
editor.update(cx, |editor, cx| editor.set_text("one\ntwo\nthree\n", cx));
|
||||
|
||||
let format = editor.update(cx, |editor, cx| editor.perform_format(project.clone(), cx));
|
||||
let format = editor.update(cx, |editor, cx| {
|
||||
editor.perform_format(project.clone(), FormatTrigger::Manual, cx)
|
||||
});
|
||||
fake_server
|
||||
.handle_request::<lsp::request::Formatting, _, _>(move |params, _| async move {
|
||||
assert_eq!(
|
||||
|
@ -4225,7 +4227,9 @@ async fn test_document_format_manual_trigger(cx: &mut gpui::TestAppContext) {
|
|||
futures::future::pending::<()>().await;
|
||||
unreachable!()
|
||||
});
|
||||
let format = editor.update(cx, |editor, cx| editor.perform_format(project, cx));
|
||||
let format = editor.update(cx, |editor, cx| {
|
||||
editor.perform_format(project, FormatTrigger::Manual, cx)
|
||||
});
|
||||
cx.foreground().advance_clock(super::FORMAT_TIMEOUT);
|
||||
cx.foreground().start_waiting();
|
||||
format.await.unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue