1#![allow(unused_variables, dead_code, unused_mut)]
2// todo!() this is to make transition easier.
3
4// Allow binary to be called Zed for a nice application menu when running executable directly
5#![allow(non_snake_case)]
6
7use anyhow::{anyhow, Context as _, Result};
8use backtrace::Backtrace;
9use cli::FORCE_CLI_MODE_ENV_VAR_NAME;
10use client::UserStore;
11use db::kvp::KEY_VALUE_STORE;
12use editor::Editor;
13use fs::RealFs;
14use futures::StreamExt;
15use gpui::{Action, App, AppContext, AsyncAppContext, Context, SemanticVersion, Task};
16use isahc::{prelude::Configurable, Request};
17use language::LanguageRegistry;
18use log::LevelFilter;
19
20use node_runtime::RealNodeRuntime;
21use parking_lot::Mutex;
22use serde::{Deserialize, Serialize};
23use settings::{
24 default_settings, handle_keymap_file_changes, handle_settings_file_changes, watch_config_file,
25 Settings, SettingsStore,
26};
27use simplelog::ConfigBuilder;
28use smol::process::Command;
29use std::{
30 env,
31 ffi::OsStr,
32 fs::OpenOptions,
33 io::{IsTerminal, Write},
34 panic,
35 path::{Path, PathBuf},
36 sync::{
37 atomic::{AtomicU32, Ordering},
38 Arc,
39 },
40 thread,
41 time::{SystemTime, UNIX_EPOCH},
42};
43use theme::ActiveTheme;
44use util::{
45 async_maybe,
46 channel::{parse_zed_link, ReleaseChannel, RELEASE_CHANNEL},
47 http::{self, HttpClient},
48 paths, ResultExt,
49};
50use uuid::Uuid;
51use workspace::{AppState, WorkspaceStore};
52use zed2::{
53 build_window_options, ensure_only_instance, handle_cli_connection, initialize_workspace,
54 languages, Assets, IsOnlyInstance, OpenListener, OpenRequest,
55};
56
57mod open_listener;
58
59fn main() {
60 menu::init();
61 let http = http::client();
62 init_paths();
63 init_logger();
64
65 if ensure_only_instance() != IsOnlyInstance::Yes {
66 return;
67 }
68
69 log::info!("========== starting zed ==========");
70 let app = App::production(Arc::new(Assets));
71
72 let installation_id = app.background_executor().block(installation_id()).ok();
73 let session_id = Uuid::new_v4().to_string();
74 init_panic_hook(&app, installation_id.clone(), session_id.clone());
75
76 let fs = Arc::new(RealFs);
77 let user_settings_file_rx = watch_config_file(
78 &app.background_executor(),
79 fs.clone(),
80 paths::SETTINGS.clone(),
81 );
82 let user_keymap_file_rx = watch_config_file(
83 &app.background_executor(),
84 fs.clone(),
85 paths::KEYMAP.clone(),
86 );
87
88 let login_shell_env_loaded = if stdout_is_a_pty() {
89 Task::ready(())
90 } else {
91 app.background_executor().spawn(async {
92 load_login_shell_environment().await.log_err();
93 })
94 };
95
96 let (listener, mut open_rx) = OpenListener::new();
97 let listener = Arc::new(listener);
98 let open_listener = listener.clone();
99 app.on_open_urls(move |urls, _| open_listener.open_urls(urls));
100 app.on_reopen(move |_cx| {
101 // todo!("workspace")
102 // if cx.has_global::<Weak<AppState>>() {
103 // if let Some(app_state) = cx.global::<Weak<AppState>>().upgrade() {
104 // workspace::open_new(&app_state, cx, |workspace, cx| {
105 // Editor::new_file(workspace, &Default::default(), cx)
106 // })
107 // .detach();
108 // }
109 // }
110 });
111
112 app.run(move |cx| {
113 cx.set_global(*RELEASE_CHANNEL);
114 load_embedded_fonts(cx);
115
116 let mut store = SettingsStore::default();
117 store
118 .set_default_settings(default_settings().as_ref(), cx)
119 .unwrap();
120 cx.set_global(store);
121 handle_settings_file_changes(user_settings_file_rx, cx);
122 handle_keymap_file_changes(user_keymap_file_rx, cx);
123
124 let client = client::Client::new(http.clone(), cx);
125 let mut languages = LanguageRegistry::new(login_shell_env_loaded);
126 let copilot_language_server_id = languages.next_language_server_id();
127 languages.set_executor(cx.background_executor().clone());
128 languages.set_language_server_download_dir(paths::LANGUAGES_DIR.clone());
129 let languages = Arc::new(languages);
130 let node_runtime = RealNodeRuntime::new(http.clone());
131
132 language::init(cx);
133 languages::init(languages.clone(), node_runtime.clone(), cx);
134 let user_store = cx.build_model(|cx| UserStore::new(client.clone(), http.clone(), cx));
135 let workspace_store = cx.build_model(|cx| WorkspaceStore::new(client.clone(), cx));
136
137 cx.set_global(client.clone());
138
139 theme::init(cx);
140 // context_menu::init(cx);
141 project::Project::init(&client, cx);
142 client::init(&client, cx);
143 command_palette::init(cx);
144 language::init(cx);
145 editor::init(cx);
146 copilot::init(
147 copilot_language_server_id,
148 http.clone(),
149 node_runtime.clone(),
150 cx,
151 );
152 // assistant::init(cx);
153 // component_test::init(cx);
154
155 // cx.spawn(|cx| watch_themes(fs.clone(), cx)).detach();
156 // cx.spawn(|_| watch_languages(fs.clone(), languages.clone()))
157 // .detach();
158 // watch_file_types(fs.clone(), cx);
159
160 languages.set_theme(cx.theme().clone());
161 // cx.observe_global::<SettingsStore, _>({
162 // let languages = languages.clone();
163 // move |cx| languages.set_theme(theme::current(cx).clone())
164 // })
165 // .detach();
166
167 // client.telemetry().start(installation_id, session_id, cx);
168
169 let app_state = Arc::new(AppState {
170 languages,
171 client: client.clone(),
172 user_store,
173 fs,
174 build_window_options,
175 initialize_workspace,
176 // background_actions: todo!("ask Mikayla"),
177 workspace_store,
178 node_runtime,
179 });
180 cx.set_global(Arc::downgrade(&app_state));
181
182 // audio::init(Assets, cx);
183 // auto_update::init(http.clone(), client::ZED_SERVER_URL.clone(), cx);
184
185 workspace::init(app_state.clone(), cx);
186 // recent_projects::init(cx);
187
188 go_to_line::init(cx);
189 // file_finder::init(cx);
190 // outline::init(cx);
191 // project_symbols::init(cx);
192 // project_panel::init(Assets, cx);
193 // channel::init(&client, user_store.clone(), cx);
194 // diagnostics::init(cx);
195 // search::init(cx);
196 // semantic_index::init(fs.clone(), http.clone(), languages.clone(), cx);
197 // vim::init(cx);
198 // terminal_view::init(cx);
199
200 // journal2::init(app_state.clone(), cx);
201 // language_selector::init(cx);
202 // theme_selector::init(cx);
203 // activity_indicator::init(cx);
204 // language_tools::init(cx);
205 call::init(app_state.client.clone(), app_state.user_store.clone(), cx);
206 // collab_ui::init(&app_state, cx);
207 // feedback::init(cx);
208 // welcome::init(cx);
209 // zed::init(&app_state, cx);
210
211 // cx.set_menus(menus::menus());
212
213 if stdout_is_a_pty() {
214 cx.activate(true);
215 let urls = collect_url_args();
216 if !urls.is_empty() {
217 listener.open_urls(urls)
218 }
219 } else {
220 upload_previous_panics(http.clone(), cx);
221
222 // TODO Development mode that forces the CLI mode usually runs Zed binary as is instead
223 // of an *app, hence gets no specific callbacks run. Emulate them here, if needed.
224 if std::env::var(FORCE_CLI_MODE_ENV_VAR_NAME).ok().is_some()
225 && !listener.triggered.load(Ordering::Acquire)
226 {
227 listener.open_urls(collect_url_args())
228 }
229 }
230
231 let mut _triggered_authentication = false;
232
233 fn open_paths_and_log_errs(
234 paths: &[PathBuf],
235 app_state: &Arc<AppState>,
236 cx: &mut AppContext,
237 ) {
238 let task = workspace::open_paths(&paths, &app_state, None, cx);
239 cx.spawn(|cx| async move {
240 if let Some((_window, results)) = task.await.log_err() {
241 for result in results {
242 if let Some(Err(e)) = result {
243 log::error!("Error opening path: {}", e);
244 }
245 }
246 }
247 })
248 .detach();
249 }
250
251 match open_rx.try_next() {
252 Ok(Some(OpenRequest::Paths { paths })) => {
253 open_paths_and_log_errs(&paths, &app_state, cx)
254 }
255 Ok(Some(OpenRequest::CliConnection { connection })) => {
256 let app_state = app_state.clone();
257 cx.spawn(move |cx| handle_cli_connection(connection, app_state, cx))
258 .detach();
259 }
260 Ok(Some(OpenRequest::JoinChannel { channel_id: _ })) => {
261 todo!()
262 // triggered_authentication = true;
263 // let app_state = app_state.clone();
264 // let client = client.clone();
265 // cx.spawn(|mut cx| async move {
266 // // ignore errors here, we'll show a generic "not signed in"
267 // let _ = authenticate(client, &cx).await;
268 // cx.update(|cx| workspace::join_channel(channel_id, app_state, None, cx))
269 // .await
270 // })
271 // .detach_and_log_err(cx)
272 }
273 Ok(Some(OpenRequest::OpenChannelNotes { channel_id: _ })) => {
274 todo!()
275 }
276 Ok(None) | Err(_) => cx
277 .spawn({
278 let app_state = app_state.clone();
279 |cx| async move { restore_or_create_workspace(&app_state, cx).await }
280 })
281 .detach(),
282 }
283
284 let app_state = app_state.clone();
285 cx.spawn(|cx| async move {
286 while let Some(request) = open_rx.next().await {
287 match request {
288 OpenRequest::Paths { paths } => {
289 cx.update(|cx| open_paths_and_log_errs(&paths, &app_state, cx))
290 .ok();
291 }
292 OpenRequest::CliConnection { connection } => {
293 let app_state = app_state.clone();
294 cx.spawn(move |cx| {
295 handle_cli_connection(connection, app_state.clone(), cx)
296 })
297 .detach();
298 }
299 OpenRequest::JoinChannel { channel_id: _ } => {
300 todo!()
301 }
302 OpenRequest::OpenChannelNotes { channel_id: _ } => {
303 todo!()
304 }
305 }
306 }
307 })
308 .detach();
309
310 // if !triggered_authentication {
311 // cx.spawn(|cx| async move { authenticate(client, &cx).await })
312 // .detach_and_log_err(cx);
313 // }
314 });
315}
316
317// async fn authenticate(client: Arc<Client>, cx: &AsyncAppContext) -> Result<()> {
318// if stdout_is_a_pty() {
319// if client::IMPERSONATE_LOGIN.is_some() {
320// client.authenticate_and_connect(false, &cx).await?;
321// }
322// } else if client.has_keychain_credentials(&cx) {
323// client.authenticate_and_connect(true, &cx).await?;
324// }
325// Ok::<_, anyhow::Error>(())
326// }
327
328async fn installation_id() -> Result<String> {
329 let legacy_key_name = "device_id";
330
331 if let Ok(Some(installation_id)) = KEY_VALUE_STORE.read_kvp(legacy_key_name) {
332 Ok(installation_id)
333 } else {
334 let installation_id = Uuid::new_v4().to_string();
335
336 KEY_VALUE_STORE
337 .write_kvp(legacy_key_name.to_string(), installation_id.clone())
338 .await?;
339
340 Ok(installation_id)
341 }
342}
343
344async fn restore_or_create_workspace(app_state: &Arc<AppState>, mut cx: AsyncAppContext) {
345 async_maybe!({
346 if let Some(location) = workspace::last_opened_workspace_paths().await {
347 cx.update(|cx| workspace::open_paths(location.paths().as_ref(), app_state, None, cx))?
348 .await
349 .log_err();
350 } else if matches!(KEY_VALUE_STORE.read_kvp("******* THIS IS A BAD KEY PLEASE UNCOMMENT BELOW TO FIX THIS VERY LONG LINE *******"), Ok(None)) {
351 // todo!(welcome)
352 //} else if matches!(KEY_VALUE_STORE.read_kvp(FIRST_OPEN), Ok(None)) {
353 //todo!()
354 // cx.update(|cx| show_welcome_experience(app_state, cx));
355 } else {
356 cx.update(|cx| {
357 workspace::open_new(app_state, cx, |workspace, cx| {
358 Editor::new_file(workspace, &Default::default(), cx)
359 })
360 .detach();
361 })?;
362 }
363 anyhow::Ok(())
364 })
365 .await
366 .log_err();
367}
368
369fn init_paths() {
370 std::fs::create_dir_all(&*util::paths::CONFIG_DIR).expect("could not create config path");
371 std::fs::create_dir_all(&*util::paths::LANGUAGES_DIR).expect("could not create languages path");
372 std::fs::create_dir_all(&*util::paths::DB_DIR).expect("could not create database path");
373 std::fs::create_dir_all(&*util::paths::LOGS_DIR).expect("could not create logs path");
374}
375
376fn init_logger() {
377 if stdout_is_a_pty() {
378 env_logger::init();
379 } else {
380 let level = LevelFilter::Info;
381
382 // Prevent log file from becoming too large.
383 const KIB: u64 = 1024;
384 const MIB: u64 = 1024 * KIB;
385 const MAX_LOG_BYTES: u64 = MIB;
386 if std::fs::metadata(&*paths::LOG).map_or(false, |metadata| metadata.len() > MAX_LOG_BYTES)
387 {
388 let _ = std::fs::rename(&*paths::LOG, &*paths::OLD_LOG);
389 }
390
391 let log_file = OpenOptions::new()
392 .create(true)
393 .append(true)
394 .open(&*paths::LOG)
395 .expect("could not open logfile");
396
397 let config = ConfigBuilder::new()
398 .set_time_format_str("%Y-%m-%dT%T") //All timestamps are UTC
399 .build();
400
401 simplelog::WriteLogger::init(level, config, log_file).expect("could not initialize logger");
402 }
403}
404
405#[derive(Serialize, Deserialize)]
406struct LocationData {
407 file: String,
408 line: u32,
409}
410
411#[derive(Serialize, Deserialize)]
412struct Panic {
413 thread: String,
414 payload: String,
415 #[serde(skip_serializing_if = "Option::is_none")]
416 location_data: Option<LocationData>,
417 backtrace: Vec<String>,
418 app_version: String,
419 release_channel: String,
420 os_name: String,
421 os_version: Option<String>,
422 architecture: String,
423 panicked_on: u128,
424 #[serde(skip_serializing_if = "Option::is_none")]
425 installation_id: Option<String>,
426 session_id: String,
427}
428
429#[derive(Serialize)]
430struct PanicRequest {
431 panic: Panic,
432 token: String,
433}
434
435static PANIC_COUNT: AtomicU32 = AtomicU32::new(0);
436
437fn init_panic_hook(app: &App, installation_id: Option<String>, session_id: String) {
438 let is_pty = stdout_is_a_pty();
439 let app_metadata = app.metadata();
440
441 panic::set_hook(Box::new(move |info| {
442 let prior_panic_count = PANIC_COUNT.fetch_add(1, Ordering::SeqCst);
443 if prior_panic_count > 0 {
444 // Give the panic-ing thread time to write the panic file
445 loop {
446 std::thread::yield_now();
447 }
448 }
449
450 let thread = thread::current();
451 let thread_name = thread.name().unwrap_or("<unnamed>");
452
453 let payload = info
454 .payload()
455 .downcast_ref::<&str>()
456 .map(|s| s.to_string())
457 .or_else(|| info.payload().downcast_ref::<String>().map(|s| s.clone()))
458 .unwrap_or_else(|| "Box<Any>".to_string());
459
460 if *util::channel::RELEASE_CHANNEL == ReleaseChannel::Dev {
461 let location = info.location().unwrap();
462 let backtrace = Backtrace::new();
463 eprintln!(
464 "Thread {:?} panicked with {:?} at {}:{}:{}\n{:?}",
465 thread_name,
466 payload,
467 location.file(),
468 location.line(),
469 location.column(),
470 backtrace,
471 );
472 std::process::exit(-1);
473 }
474
475 let app_version = client::ZED_APP_VERSION
476 .or(app_metadata.app_version)
477 .map_or("dev".to_string(), |v| v.to_string());
478
479 let backtrace = Backtrace::new();
480 let mut backtrace = backtrace
481 .frames()
482 .iter()
483 .filter_map(|frame| Some(format!("{:#}", frame.symbols().first()?.name()?)))
484 .collect::<Vec<_>>();
485
486 // Strip out leading stack frames for rust panic-handling.
487 if let Some(ix) = backtrace
488 .iter()
489 .position(|name| name == "rust_begin_unwind")
490 {
491 backtrace.drain(0..=ix);
492 }
493
494 let panic_data = Panic {
495 thread: thread_name.into(),
496 payload: payload.into(),
497 location_data: info.location().map(|location| LocationData {
498 file: location.file().into(),
499 line: location.line(),
500 }),
501 app_version: app_version.clone(),
502 release_channel: RELEASE_CHANNEL.display_name().into(),
503 os_name: app_metadata.os_name.into(),
504 os_version: app_metadata
505 .os_version
506 .as_ref()
507 .map(SemanticVersion::to_string),
508 architecture: env::consts::ARCH.into(),
509 panicked_on: SystemTime::now()
510 .duration_since(UNIX_EPOCH)
511 .unwrap()
512 .as_millis(),
513 backtrace,
514 installation_id: installation_id.clone(),
515 session_id: session_id.clone(),
516 };
517
518 if let Some(panic_data_json) = serde_json::to_string_pretty(&panic_data).log_err() {
519 log::error!("{}", panic_data_json);
520 }
521
522 if !is_pty {
523 if let Some(panic_data_json) = serde_json::to_string(&panic_data).log_err() {
524 let timestamp = chrono::Utc::now().format("%Y_%m_%d %H_%M_%S").to_string();
525 let panic_file_path = paths::LOGS_DIR.join(format!("zed-{}.panic", timestamp));
526 let panic_file = std::fs::OpenOptions::new()
527 .append(true)
528 .create(true)
529 .open(&panic_file_path)
530 .log_err();
531 if let Some(mut panic_file) = panic_file {
532 writeln!(&mut panic_file, "{}", panic_data_json).log_err();
533 panic_file.flush().log_err();
534 }
535 }
536 }
537
538 std::process::abort();
539 }));
540}
541
542fn upload_previous_panics(http: Arc<dyn HttpClient>, cx: &mut AppContext) {
543 let telemetry_settings = *client::TelemetrySettings::get_global(cx);
544
545 cx.background_executor()
546 .spawn(async move {
547 let panic_report_url = format!("{}/api/panic", &*client::ZED_SERVER_URL);
548 let mut children = smol::fs::read_dir(&*paths::LOGS_DIR).await?;
549 while let Some(child) = children.next().await {
550 let child = child?;
551 let child_path = child.path();
552
553 if child_path.extension() != Some(OsStr::new("panic")) {
554 continue;
555 }
556 let filename = if let Some(filename) = child_path.file_name() {
557 filename.to_string_lossy()
558 } else {
559 continue;
560 };
561
562 if !filename.starts_with("zed") {
563 continue;
564 }
565
566 if telemetry_settings.diagnostics {
567 let panic_file_content = smol::fs::read_to_string(&child_path)
568 .await
569 .context("error reading panic file")?;
570
571 let panic = serde_json::from_str(&panic_file_content)
572 .ok()
573 .or_else(|| {
574 panic_file_content
575 .lines()
576 .next()
577 .and_then(|line| serde_json::from_str(line).ok())
578 })
579 .unwrap_or_else(|| {
580 log::error!(
581 "failed to deserialize panic file {:?}",
582 panic_file_content
583 );
584 None
585 });
586
587 if let Some(panic) = panic {
588 let body = serde_json::to_string(&PanicRequest {
589 panic,
590 token: client::ZED_SECRET_CLIENT_TOKEN.into(),
591 })
592 .unwrap();
593
594 let request = Request::post(&panic_report_url)
595 .redirect_policy(isahc::config::RedirectPolicy::Follow)
596 .header("Content-Type", "application/json")
597 .body(body.into())?;
598 let response = http.send(request).await.context("error sending panic")?;
599 if !response.status().is_success() {
600 log::error!("Error uploading panic to server: {}", response.status());
601 }
602 }
603 }
604
605 // We've done what we can, delete the file
606 std::fs::remove_file(child_path)
607 .context("error removing panic")
608 .log_err();
609 }
610 Ok::<_, anyhow::Error>(())
611 })
612 .detach_and_log_err(cx);
613}
614
615async fn load_login_shell_environment() -> Result<()> {
616 let marker = "ZED_LOGIN_SHELL_START";
617 let shell = env::var("SHELL").context(
618 "SHELL environment variable is not assigned so we can't source login environment variables",
619 )?;
620 let output = Command::new(&shell)
621 .args(["-lic", &format!("echo {marker} && /usr/bin/env -0")])
622 .output()
623 .await
624 .context("failed to spawn login shell to source login environment variables")?;
625 if !output.status.success() {
626 Err(anyhow!("login shell exited with error"))?;
627 }
628
629 let stdout = String::from_utf8_lossy(&output.stdout);
630
631 if let Some(env_output_start) = stdout.find(marker) {
632 let env_output = &stdout[env_output_start + marker.len()..];
633 for line in env_output.split_terminator('\0') {
634 if let Some(separator_index) = line.find('=') {
635 let key = &line[..separator_index];
636 let value = &line[separator_index + 1..];
637 env::set_var(key, value);
638 }
639 }
640 log::info!(
641 "set environment variables from shell:{}, path:{}",
642 shell,
643 env::var("PATH").unwrap_or_default(),
644 );
645 }
646
647 Ok(())
648}
649
650fn stdout_is_a_pty() -> bool {
651 std::env::var(FORCE_CLI_MODE_ENV_VAR_NAME).ok().is_none() && std::io::stdout().is_terminal()
652}
653
654fn collect_url_args() -> Vec<String> {
655 env::args()
656 .skip(1)
657 .filter_map(|arg| match std::fs::canonicalize(Path::new(&arg)) {
658 Ok(path) => Some(format!("file://{}", path.to_string_lossy())),
659 Err(error) => {
660 if let Some(_) = parse_zed_link(&arg) {
661 Some(arg)
662 } else {
663 log::error!("error parsing path argument: {}", error);
664 None
665 }
666 }
667 })
668 .collect()
669}
670
671fn load_embedded_fonts(cx: &AppContext) {
672 let asset_source = cx.asset_source();
673 let font_paths = asset_source.list("fonts").unwrap();
674 let embedded_fonts = Mutex::new(Vec::new());
675 let executor = cx.background_executor();
676
677 executor.block(executor.scoped(|scope| {
678 for font_path in &font_paths {
679 if !font_path.ends_with(".ttf") {
680 continue;
681 }
682
683 scope.spawn(async {
684 let font_bytes = asset_source.load(font_path).unwrap().to_vec();
685 embedded_fonts.lock().push(Arc::from(font_bytes));
686 });
687 }
688 }));
689
690 cx.text_system()
691 .add_fonts(&embedded_fonts.into_inner())
692 .unwrap();
693}
694
695// #[cfg(debug_assertions)]
696// async fn watch_themes(fs: Arc<dyn Fs>, mut cx: AsyncAppContext) -> Option<()> {
697// let mut events = fs
698// .watch("styles/src".as_ref(), Duration::from_millis(100))
699// .await;
700// while (events.next().await).is_some() {
701// let output = Command::new("npm")
702// .current_dir("styles")
703// .args(["run", "build"])
704// .output()
705// .await
706// .log_err()?;
707// if output.status.success() {
708// cx.update(|cx| theme_selector::reload(cx))
709// } else {
710// eprintln!(
711// "build script failed {}",
712// String::from_utf8_lossy(&output.stderr)
713// );
714// }
715// }
716// Some(())
717// }
718
719// #[cfg(debug_assertions)]
720// async fn watch_languages(fs: Arc<dyn Fs>, languages: Arc<LanguageRegistry>) -> Option<()> {
721// let mut events = fs
722// .watch(
723// "crates/zed/src/languages".as_ref(),
724// Duration::from_millis(100),
725// )
726// .await;
727// while (events.next().await).is_some() {
728// languages.reload();
729// }
730// Some(())
731// }
732
733// #[cfg(debug_assertions)]
734// fn watch_file_types(fs: Arc<dyn Fs>, cx: &mut AppContext) {
735// cx.spawn(|mut cx| async move {
736// let mut events = fs
737// .watch(
738// "assets/icons/file_icons/file_types.json".as_ref(),
739// Duration::from_millis(100),
740// )
741// .await;
742// while (events.next().await).is_some() {
743// cx.update(|cx| {
744// cx.update_global(|file_types, _| {
745// *file_types = project_panel::file_associations::FileAssociations::new(Assets);
746// });
747// })
748// }
749// })
750// .detach()
751// }
752
753// #[cfg(not(debug_assertions))]
754// async fn watch_themes(_fs: Arc<dyn Fs>, _cx: AsyncAppContext) -> Option<()> {
755// None
756// }
757
758// #[cfg(not(debug_assertions))]
759// async fn watch_languages(_: Arc<dyn Fs>, _: Arc<LanguageRegistry>) -> Option<()> {
760// None
761//
762
763// #[cfg(not(debug_assertions))]
764// fn watch_file_types(_fs: Arc<dyn Fs>, _cx: &mut AppContext) {}
765
766pub fn background_actions() -> &'static [(&'static str, &'static dyn Action)] {
767 // &[
768 // ("Go to file", &file_finder::Toggle),
769 // ("Open command palette", &command_palette::Toggle),
770 // ("Open recent projects", &recent_projects::OpenRecent),
771 // ("Change your settings", &zed_actions::OpenSettings),
772 // ]
773 // todo!()
774 &[]
775}