diff --git a/helix-loader/src/lib.rs b/helix-loader/src/lib.rs index b8b4af50d2075..1ab921334b0e4 100644 --- a/helix-loader/src/lib.rs +++ b/helix-loader/src/lib.rs @@ -16,7 +16,7 @@ static CONFIG_FILE: once_cell::sync::OnceCell = once_cell::sync::OnceCe static LOG_FILE: once_cell::sync::OnceCell = once_cell::sync::OnceCell::new(); -static SHADA_FILE: once_cell::sync::OnceCell = once_cell::sync::OnceCell::new(); +static SESSION_FILE: once_cell::sync::OnceCell = once_cell::sync::OnceCell::new(); // Get the current working directory. // This information is managed internally as the call to std::env::current_dir @@ -55,10 +55,10 @@ pub fn initialize_log_file(specified_file: Option) { LOG_FILE.set(log_file).ok(); } -pub fn initialize_shada_file(specified_file: Option) { - let shada_file = specified_file.unwrap_or_else(default_shada_file); - ensure_parent_dir(&shada_file); - SHADA_FILE.set(shada_file).ok(); +pub fn initialize_session_file(specified_file: Option) { + let session_file = specified_file.unwrap_or_else(default_session_file); + ensure_parent_dir(&session_file); + SESSION_FILE.set(session_file).ok(); } /// A list of runtime directories from highest to lowest priority @@ -181,8 +181,8 @@ pub fn log_file() -> PathBuf { LOG_FILE.get().map(|path| path.to_path_buf()).unwrap() } -pub fn shada_file() -> PathBuf { - SHADA_FILE.get().map(|path| path.to_path_buf()).unwrap() +pub fn session_file() -> PathBuf { + SESSION_FILE.get().map(|path| path.to_path_buf()).unwrap() } pub fn workspace_config_file() -> PathBuf { @@ -197,8 +197,8 @@ pub fn default_log_file() -> PathBuf { cache_dir().join("helix.log") } -pub fn default_shada_file() -> PathBuf { - state_dir().join("helix.shada") +pub fn default_session_file() -> PathBuf { + state_dir().join("helix.session") } /// Merge two TOML documents, merging values from `right` onto `left` diff --git a/helix-term/Cargo.toml b/helix-term/Cargo.toml index 4741a79827857..3cfadcd4c5766 100644 --- a/helix-term/Cargo.toml +++ b/helix-term/Cargo.toml @@ -67,7 +67,7 @@ toml = "0.7" serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } -# shada +# session persistence bincode = "2.0.0-rc.3" # ripgrep for global search diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 180c686229536..3900f4ed1dc81 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -29,7 +29,7 @@ use crate::{ config::Config, job::Jobs, keymap::Keymaps, - shada, + session, ui::{self, overlay::overlaid}, }; @@ -1216,7 +1216,7 @@ impl Application { } #[cfg(not(feature = "integration"))] - shada::write_shada_file(); + session::write_session_file(); errs } diff --git a/helix-term/src/args.rs b/helix-term/src/args.rs index feaf8dd7f047d..b49cb575a0f81 100644 --- a/helix-term/src/args.rs +++ b/helix-term/src/args.rs @@ -16,7 +16,7 @@ pub struct Args { pub verbosity: u64, pub log_file: Option, pub config_file: Option, - pub shada_file: Option, + pub session_file: Option, pub files: Vec<(PathBuf, Position)>, pub working_directory: Option, } @@ -62,9 +62,9 @@ impl Args { Some(path) => args.log_file = Some(path.into()), None => anyhow::bail!("--log must specify a path to write"), }, - "--shada" => match argv.next().as_deref() { - Some(path) => args.shada_file = Some(path.into()), - None => anyhow::bail!("--shada must specify a path to write"), + "--session-file" => match argv.next().as_deref() { + Some(path) => args.session_file = Some(path.into()), + None => anyhow::bail!("--session-file must specify a path to write"), }, "-w" | "--working-dir" => match argv.next().as_deref() { Some(path) => { diff --git a/helix-term/src/lib.rs b/helix-term/src/lib.rs index 5567a27346595..934f4e1b0c6e8 100644 --- a/helix-term/src/lib.rs +++ b/helix-term/src/lib.rs @@ -9,7 +9,7 @@ pub mod config; pub mod health; pub mod job; pub mod keymap; -pub mod shada; +pub mod session; pub mod ui; use std::path::Path; diff --git a/helix-term/src/main.rs b/helix-term/src/main.rs index 9002cee996b17..6e3194546b6b8 100644 --- a/helix-term/src/main.rs +++ b/helix-term/src/main.rs @@ -63,7 +63,7 @@ FLAGS: -v Increases logging verbosity each use for up to 3 times --log Specifies a file to use for logging (default file: {}) - --shada Specifies a file to use for shared data + --session-file Specifies a file to use for shared data -V, --version Prints version information --vsplit Splits all given files vertically into different windows --hsplit Splits all given files horizontally into different windows @@ -81,7 +81,7 @@ FLAGS: helix_loader::initialize_config_file(args.config_file.clone()); helix_loader::initialize_log_file(args.log_file.clone()); - helix_loader::initialize_shada_file(args.shada_file.clone()); + helix_loader::initialize_session_file(args.session_file.clone()); // Help has a higher priority and should be handled separately. if args.display_help { diff --git a/helix-term/src/shada.rs b/helix-term/src/session.rs similarity index 84% rename from helix-term/src/shada.rs rename to helix-term/src/session.rs index 9dc890e7effa9..fc36a9a56f53a 100644 --- a/helix-term/src/shada.rs +++ b/helix-term/src/session.rs @@ -1,5 +1,5 @@ use bincode::{encode_into_std_write, Decode, Encode}; -use helix_loader::{shada_file, VERSION_AND_GIT_HASH}; +use helix_loader::{session_file, VERSION_AND_GIT_HASH}; // use helix_view::view::ViewPosition; use std::{ fs::File, @@ -55,14 +55,14 @@ fn generate_header() -> Entry { } } -pub fn write_shada_file() { +pub fn write_session_file() { // TODO: merge existing file if exists // TODO: do something about this unwrap - let mut shada_file = File::create(shada_file()).unwrap(); + let mut session_file = File::create(session_file()).unwrap(); let header = generate_header(); // TODO: do something about this unwrap - encode_into_std_write(&header, &mut shada_file, bincode::config::standard()).unwrap(); + encode_into_std_write(&header, &mut session_file, bincode::config::standard()).unwrap(); }