265608a3d8
* auto save after delay * configable * clearer names * init * working with some odd behaviour * working with greater consistency * Apply reviewer suggestions - Remove unneccessary field - Remove blocking save * Improve auto-save configuration Auto save can be configured to trigger on focus loss: ```toml auto-save.focus-lost = true|false ``` and after a time delay (in milli seconds) since last keypress: ```toml auto-save.after-delay.enable = true|false auto-save.after-delay.timeout = [0, u64::MAX] # default: 3000 ``` * Remove boilerplate and unnecessary types * Remove more useless types * Update docs for auto-save.after-delay * Fix wording of (doc) comments relating to auto-save * book: Move auto-save descriptions to separate section --------- Co-authored-by: Miguel Perez <miguelvojito@gmail.com> Co-authored-by: Miguel Perez <perezoji@cs.fsu.edu>
36 lines
932 B
Rust
36 lines
932 B
Rust
use std::sync::Arc;
|
|
|
|
use arc_swap::ArcSwap;
|
|
use helix_event::AsyncHook;
|
|
|
|
use crate::config::Config;
|
|
use crate::events;
|
|
use crate::handlers::auto_save::AutoSaveHandler;
|
|
use crate::handlers::completion::CompletionHandler;
|
|
use crate::handlers::signature_help::SignatureHelpHandler;
|
|
|
|
pub use completion::trigger_auto_completion;
|
|
pub use helix_view::handlers::Handlers;
|
|
|
|
mod auto_save;
|
|
pub mod completion;
|
|
mod signature_help;
|
|
|
|
pub fn setup(config: Arc<ArcSwap<Config>>) -> Handlers {
|
|
events::register();
|
|
|
|
let completions = CompletionHandler::new(config).spawn();
|
|
let signature_hints = SignatureHelpHandler::new().spawn();
|
|
let auto_save = AutoSaveHandler::new().spawn();
|
|
|
|
let handlers = Handlers {
|
|
completions,
|
|
signature_hints,
|
|
auto_save,
|
|
};
|
|
|
|
completion::register_hooks(&handlers);
|
|
signature_help::register_hooks(&handlers);
|
|
auto_save::register_hooks(&handlers);
|
|
handlers
|
|
}
|