Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Highlight Zed log file by default if log language is available (#38091)
Finn Evers53c5db449575
diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rsindex 7b592cf06c0..87664d20f0d 100644--- a/crates/zed/src/zed.rs+++ b/crates/zed/src/zed.rs@@ -1112,10 +1112,15 @@ fn open_log_file(workspace: &mut Workspace, window: &mut Window, cx: &mut Contexconst MAX_LINES: usize = 1000;workspace.with_local_workspace(window, cx, move |workspace, window, cx| {- let fs = workspace.app_state().fs.clone();+ let app_state = workspace.app_state();+ let languages = app_state.languages.clone();+ let fs = app_state.fs.clone();cx.spawn_in(window, async move |workspace, cx| {- let (old_log, new_log) =- futures::join!(fs.load(paths::old_log_file()), fs.load(paths::log_file()));+ let (old_log, new_log, log_language) = futures::join!(+ fs.load(paths::old_log_file()),+ fs.load(paths::log_file()),+ languages.language_for_name("log")+ );let log = match (old_log, new_log) {(Err(_), Err(_)) => None,(old_log, new_log) => {@@ -1138,6 +1143,7 @@ fn open_log_file(workspace: &mut Workspace, window: &mut Window, cx: &mut Contex)}};+ let log_language = log_language.ok();workspace.update_in(cx, |workspace, window, cx| {@@ -1163,7 +1169,7 @@ fn open_log_file(workspace: &mut Workspace, window: &mut Window, cx: &mut Contex};let project = workspace.project().clone();let buffer = project.update(cx, |project, cx| {- project.create_local_buffer(&log, None, false, cx)+ project.create_local_buffer(&log, log_language, false, cx)});let buffer = cx