WIP
This commit is contained in:
parent
a5edac312e
commit
2a5565ca93
7 changed files with 16 additions and 17 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -6793,6 +6793,7 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"backtrace",
|
"backtrace",
|
||||||
|
"dirs 3.0.2",
|
||||||
"futures 0.3.25",
|
"futures 0.3.25",
|
||||||
"git2",
|
"git2",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
|
@ -7707,7 +7708,6 @@ dependencies = [
|
||||||
"context_menu",
|
"context_menu",
|
||||||
"ctor",
|
"ctor",
|
||||||
"diagnostics",
|
"diagnostics",
|
||||||
"dirs 3.0.2",
|
|
||||||
"easy-parallel",
|
"easy-parallel",
|
||||||
"editor",
|
"editor",
|
||||||
"env_logger",
|
"env_logger",
|
||||||
|
|
|
@ -19,6 +19,7 @@ rand = { workspace = true }
|
||||||
tempdir = { version = "0.3.7", optional = true }
|
tempdir = { version = "0.3.7", optional = true }
|
||||||
serde_json = { version = "1.0", features = ["preserve_order"], optional = true }
|
serde_json = { version = "1.0", features = ["preserve_order"], optional = true }
|
||||||
git2 = { version = "0.15", default-features = false, optional = true }
|
git2 = { version = "0.15", default-features = false, optional = true }
|
||||||
|
dirs = "3.0"
|
||||||
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
pub mod paths;
|
||||||
#[cfg(any(test, feature = "test-support"))]
|
#[cfg(any(test, feature = "test-support"))]
|
||||||
pub mod test;
|
pub mod test;
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,6 @@ async-trait = "0.1"
|
||||||
backtrace = "0.3"
|
backtrace = "0.3"
|
||||||
chrono = "0.4"
|
chrono = "0.4"
|
||||||
ctor = "0.1.20"
|
ctor = "0.1.20"
|
||||||
dirs = "3.0"
|
|
||||||
easy-parallel = "3.1.0"
|
easy-parallel = "3.1.0"
|
||||||
env_logger = "0.9"
|
env_logger = "0.9"
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
|
|
|
@ -37,7 +37,7 @@ use terminal::terminal_container_view::{get_working_directory, TerminalContainer
|
||||||
use fs::RealFs;
|
use fs::RealFs;
|
||||||
use settings::watched_json::{watch_keymap_file, watch_settings_file, WatchedJsonFile};
|
use settings::watched_json::{watch_keymap_file, watch_settings_file, WatchedJsonFile};
|
||||||
use theme::ThemeRegistry;
|
use theme::ThemeRegistry;
|
||||||
use util::{ResultExt, TryFutureExt};
|
use util::{paths, ResultExt, TryFutureExt};
|
||||||
use workspace::{self, AppState, ItemHandle, NewFile, OpenPaths, Workspace};
|
use workspace::{self, AppState, ItemHandle, NewFile, OpenPaths, Workspace};
|
||||||
use zed::{
|
use zed::{
|
||||||
self, build_window_options, initialize_workspace, languages, menus, RELEASE_CHANNEL,
|
self, build_window_options, initialize_workspace, languages, menus, RELEASE_CHANNEL,
|
||||||
|
@ -57,7 +57,7 @@ fn main() {
|
||||||
init_panic_hook(app_version, http.clone(), app.background());
|
init_panic_hook(app_version, http.clone(), app.background());
|
||||||
|
|
||||||
let db = app.background().spawn(async move {
|
let db = app.background().spawn(async move {
|
||||||
project::Db::<project::KeyValue>::open(&*zed::paths::DB_DIR, RELEASE_CHANNEL_NAME.as_str())
|
project::Db::<project::KeyValue>::open(&*paths::DB_DIR, RELEASE_CHANNEL_NAME.as_str())
|
||||||
});
|
});
|
||||||
|
|
||||||
load_embedded_fonts(&app);
|
load_embedded_fonts(&app);
|
||||||
|
@ -91,11 +91,11 @@ fn main() {
|
||||||
|
|
||||||
app.run(move |cx| {
|
app.run(move |cx| {
|
||||||
cx.set_global(*RELEASE_CHANNEL);
|
cx.set_global(*RELEASE_CHANNEL);
|
||||||
cx.set_global(HomeDir(zed::paths::HOME.to_path_buf()));
|
cx.set_global(HomeDir(paths::HOME.to_path_buf()));
|
||||||
|
|
||||||
let client = client::Client::new(http.clone(), cx);
|
let client = client::Client::new(http.clone(), cx);
|
||||||
let mut languages = LanguageRegistry::new(login_shell_env_loaded);
|
let mut languages = LanguageRegistry::new(login_shell_env_loaded);
|
||||||
languages.set_language_server_download_dir(zed::paths::LANGUAGES_DIR.clone());
|
languages.set_language_server_download_dir(paths::LANGUAGES_DIR.clone());
|
||||||
let languages = Arc::new(languages);
|
let languages = Arc::new(languages);
|
||||||
let init_languages = cx
|
let init_languages = cx
|
||||||
.background()
|
.background()
|
||||||
|
@ -106,7 +106,7 @@ fn main() {
|
||||||
|
|
||||||
//Setup settings global before binding actions
|
//Setup settings global before binding actions
|
||||||
cx.set_global(SettingsFile::new(
|
cx.set_global(SettingsFile::new(
|
||||||
&*zed::paths::SETTINGS,
|
&*paths::SETTINGS,
|
||||||
settings_file_content.clone(),
|
settings_file_content.clone(),
|
||||||
fs.clone(),
|
fs.clone(),
|
||||||
));
|
));
|
||||||
|
@ -236,16 +236,15 @@ fn init_logger() {
|
||||||
const KIB: u64 = 1024;
|
const KIB: u64 = 1024;
|
||||||
const MIB: u64 = 1024 * KIB;
|
const MIB: u64 = 1024 * KIB;
|
||||||
const MAX_LOG_BYTES: u64 = MIB;
|
const MAX_LOG_BYTES: u64 = MIB;
|
||||||
if std::fs::metadata(&*zed::paths::LOG)
|
if std::fs::metadata(&*paths::LOG).map_or(false, |metadata| metadata.len() > MAX_LOG_BYTES)
|
||||||
.map_or(false, |metadata| metadata.len() > MAX_LOG_BYTES)
|
|
||||||
{
|
{
|
||||||
let _ = std::fs::rename(&*zed::paths::LOG, &*zed::paths::OLD_LOG);
|
let _ = std::fs::rename(&*paths::LOG, &*paths::OLD_LOG);
|
||||||
}
|
}
|
||||||
|
|
||||||
let log_file = OpenOptions::new()
|
let log_file = OpenOptions::new()
|
||||||
.create(true)
|
.create(true)
|
||||||
.append(true)
|
.append(true)
|
||||||
.open(&*zed::paths::LOG)
|
.open(&*paths::LOG)
|
||||||
.expect("could not open logfile");
|
.expect("could not open logfile");
|
||||||
simplelog::WriteLogger::init(level, simplelog::Config::default(), log_file)
|
simplelog::WriteLogger::init(level, simplelog::Config::default(), log_file)
|
||||||
.expect("could not initialize logger");
|
.expect("could not initialize logger");
|
||||||
|
@ -257,7 +256,7 @@ fn init_panic_hook(app_version: String, http: Arc<dyn HttpClient>, background: A
|
||||||
.spawn({
|
.spawn({
|
||||||
async move {
|
async move {
|
||||||
let panic_report_url = format!("{}/api/panic", &*client::ZED_SERVER_URL);
|
let panic_report_url = format!("{}/api/panic", &*client::ZED_SERVER_URL);
|
||||||
let mut children = smol::fs::read_dir(&*zed::paths::LOGS_DIR).await?;
|
let mut children = smol::fs::read_dir(&*paths::LOGS_DIR).await?;
|
||||||
while let Some(child) = children.next().await {
|
while let Some(child) = children.next().await {
|
||||||
let child = child?;
|
let child = child?;
|
||||||
let child_path = child.path();
|
let child_path = child.path();
|
||||||
|
@ -345,7 +344,7 @@ fn init_panic_hook(app_version: String, http: Arc<dyn HttpClient>, background: A
|
||||||
|
|
||||||
let panic_filename = chrono::Utc::now().format("%Y_%m_%d %H_%M_%S").to_string();
|
let panic_filename = chrono::Utc::now().format("%Y_%m_%d %H_%M_%S").to_string();
|
||||||
std::fs::write(
|
std::fs::write(
|
||||||
zed::paths::LOGS_DIR.join(format!("zed-{}-{}.panic", app_version, panic_filename)),
|
paths::LOGS_DIR.join(format!("zed-{}-{}.panic", app_version, panic_filename)),
|
||||||
&message,
|
&message,
|
||||||
)
|
)
|
||||||
.context("error writing panic to disk")
|
.context("error writing panic to disk")
|
||||||
|
@ -479,8 +478,8 @@ fn load_config_files(
|
||||||
.clone()
|
.clone()
|
||||||
.spawn(async move {
|
.spawn(async move {
|
||||||
let settings_file =
|
let settings_file =
|
||||||
WatchedJsonFile::new(fs.clone(), &executor, zed::paths::SETTINGS.clone()).await;
|
WatchedJsonFile::new(fs.clone(), &executor, paths::SETTINGS.clone()).await;
|
||||||
let keymap_file = WatchedJsonFile::new(fs, &executor, zed::paths::KEYMAP.clone()).await;
|
let keymap_file = WatchedJsonFile::new(fs, &executor, paths::KEYMAP.clone()).await;
|
||||||
tx.send((settings_file, keymap_file)).ok()
|
tx.send((settings_file, keymap_file)).ok()
|
||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
mod feedback;
|
mod feedback;
|
||||||
pub mod languages;
|
pub mod languages;
|
||||||
pub mod menus;
|
pub mod menus;
|
||||||
pub mod paths;
|
|
||||||
#[cfg(any(test, feature = "test-support"))]
|
#[cfg(any(test, feature = "test-support"))]
|
||||||
pub mod test;
|
pub mod test;
|
||||||
|
|
||||||
|
@ -31,7 +30,7 @@ use serde::Deserialize;
|
||||||
use serde_json::to_string_pretty;
|
use serde_json::to_string_pretty;
|
||||||
use settings::{keymap_file_json_schema, settings_file_json_schema, ReleaseChannel, Settings};
|
use settings::{keymap_file_json_schema, settings_file_json_schema, ReleaseChannel, Settings};
|
||||||
use std::{env, path::Path, str, sync::Arc};
|
use std::{env, path::Path, str, sync::Arc};
|
||||||
use util::ResultExt;
|
use util::{paths, ResultExt};
|
||||||
pub use workspace;
|
pub use workspace;
|
||||||
use workspace::{sidebar::SidebarSide, AppState, Workspace};
|
use workspace::{sidebar::SidebarSide, AppState, Workspace};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue