feat: add floating and docked searchable file picker
This commit is contained in:
+8
-3
@@ -18,6 +18,7 @@ pub struct Config {
|
||||
pub plugins: Vec<PathBuf>,
|
||||
pub bindings: Vec<Binding>,
|
||||
pub leader: String,
|
||||
pub file_explorer_side: String,
|
||||
}
|
||||
|
||||
impl Default for Config {
|
||||
@@ -26,6 +27,7 @@ impl Default for Config {
|
||||
plugins: Vec::new(),
|
||||
bindings: Vec::new(),
|
||||
leader: "space".into(),
|
||||
file_explorer_side: "right".into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,6 +43,7 @@ pub fn load_config(path: &Path) -> Result<Config, String> {
|
||||
plugins,
|
||||
bindings,
|
||||
leader,
|
||||
file_explorer_side,
|
||||
..
|
||||
} => {
|
||||
let mut config = Config::default();
|
||||
@@ -53,6 +56,7 @@ pub fn load_config(path: &Path) -> Result<Config, String> {
|
||||
}
|
||||
config.bindings = bindings;
|
||||
config.leader = leader;
|
||||
config.file_explorer_side = file_explorer_side;
|
||||
Ok(config)
|
||||
}
|
||||
Response::Error {
|
||||
@@ -198,6 +202,7 @@ enum Response {
|
||||
plugins: Vec<String>,
|
||||
bindings: Vec<Binding>,
|
||||
leader: String,
|
||||
file_explorer_side: String,
|
||||
},
|
||||
#[serde(rename = "result")]
|
||||
Result {
|
||||
@@ -593,9 +598,9 @@ end
|
||||
assert!(load_config(&path).unwrap_err().contains(error), "{value}");
|
||||
}
|
||||
for frame in [
|
||||
r#"{"type":"config","version":1,"plugins":[],"bindings":[]}"#,
|
||||
r#"{"type":"config","version":1,"plugins":[],"bindings":[],"leader":null}"#,
|
||||
r#"{"type":"config","version":1,"plugins":[],"bindings":[],"leader":7}"#,
|
||||
r#"{"type":"config","version":1,"plugins":[],"bindings":[],"file_explorer_side":"right"}"#,
|
||||
r#"{"type":"config","version":1,"plugins":[],"bindings":[],"leader":null,"file_explorer_side":"right"}"#,
|
||||
r#"{"type":"config","version":1,"plugins":[],"bindings":[],"leader":7,"file_explorer_side":"right"}"#,
|
||||
] {
|
||||
assert!(serde_json::from_str::<Response>(frame).is_err(), "{frame}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user