diff options
| author | Aram Drevekenin <aram@poor.dev> | 2023-06-17 18:16:41 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-17 18:16:41 +0200 |
| commit | 805fd1dc8184154bb7c5bc24db7b20c06fc47cad (patch) | |
| tree | 164effb6ba747528be14c63f556bf88a13d9c4b3 /default-plugins/strider | |
| parent | refactor(plugins): improve api (#2552) (diff) | |
| download | sl0ppij-805fd1dc8184154bb7c5bc24db7b20c06fc47cad.tar.gz sl0ppij-805fd1dc8184154bb7c5bc24db7b20c06fc47cad.tar.xz sl0ppij-805fd1dc8184154bb7c5bc24db7b20c06fc47cad.zip | |
feat(plugins): strider improvements (#2551)
* fix(plugins): adjust debounce and smart file ignore in strider
* style(comment): remove commented code
* style(fmt): rustfmt
Diffstat (limited to 'default-plugins/strider')
| -rw-r--r-- | default-plugins/strider/Cargo.toml | 2 | ||||
| -rw-r--r-- | default-plugins/strider/src/search/mod.rs | 14 |
2 files changed, 7 insertions, 9 deletions
diff --git a/default-plugins/strider/Cargo.toml b/default-plugins/strider/Cargo.toml index 65b5d23e..33cf4ca5 100644 --- a/default-plugins/strider/Cargo.toml +++ b/default-plugins/strider/Cargo.toml @@ -10,7 +10,7 @@ license = "MIT" colored = "2.0.0" zellij-tile = { path = "../../zellij-tile" } pretty-bytes = "0.2.2" -walkdir = "2.3.3" +ignore = "0.4.20" fuzzy-matcher = "0.3.7" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/default-plugins/strider/src/search/mod.rs b/default-plugins/strider/src/search/mod.rs index 1a9db2da..33c8a60b 100644 --- a/default-plugins/strider/src/search/mod.rs +++ b/default-plugins/strider/src/search/mod.rs @@ -15,9 +15,9 @@ use zellij_tile::prelude::*; use fuzzy_matcher::skim::SkimMatcherV2; use fuzzy_matcher::FuzzyMatcher; +use ignore::Walk; use search_results::SearchResult; use serde::{Deserialize, Serialize}; -use walkdir::WalkDir; use std::io::{self, BufRead}; @@ -64,8 +64,10 @@ impl Search { } } pub fn scan_hd(&mut self) { - for entry in WalkDir::new(ROOT).into_iter().filter_map(|e| e.ok()) { - self.add_file_entry(entry.path(), entry.metadata().ok()); + for result in Walk::new(ROOT) { + if let Ok(entry) = result { + self.add_file_entry(entry.path(), entry.metadata().ok()); + } } } pub fn search(&mut self, search_term: String) { @@ -160,11 +162,7 @@ impl Search { match line { Ok(line) => { self.file_contents.insert( - ( - // String::from_utf8_lossy(&strip_ansi_escapes::strip(file_path_stripped_prefix.clone()).unwrap()).to_string(), - file_path_stripped_prefix.clone(), - index + 1, - ), + (file_path_stripped_prefix.clone(), index + 1), String::from_utf8_lossy( &strip_ansi_escapes::strip(line).unwrap(), ) |
