feat(plugins): strider improvements (#2551)
* fix(plugins): adjust debounce and smart file ignore in strider * style(comment): remove commented code * style(fmt): rustfmt
This commit is contained in:
parent
29a391f60e
commit
805fd1dc81
4 changed files with 59 additions and 12 deletions
53
Cargo.lock
generated
53
Cargo.lock
generated
|
|
@ -28,6 +28,15 @@ dependencies = [
|
|||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.7.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.0.1"
|
||||
|
|
@ -324,6 +333,16 @@ version = "0.1.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5988cb1d626264ac94100be357308f29ff7cbdd3b36bda27f450a4ee3f713426"
|
||||
|
||||
[[package]]
|
||||
name = "bstr"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a246e68bb43f6cd9db24bea052a53e40405417c5fb372e3d1a8a7f770a564ef5"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.10.0"
|
||||
|
|
@ -1209,6 +1228,19 @@ dependencies = [
|
|||
"stable_deref_trait",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "globset"
|
||||
version = "0.4.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc"
|
||||
dependencies = [
|
||||
"aho-corasick 0.7.20",
|
||||
"bstr",
|
||||
"fnv",
|
||||
"log",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gloo-timers"
|
||||
version = "0.2.4"
|
||||
|
|
@ -1304,6 +1336,23 @@ dependencies = [
|
|||
"unicode-normalization",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ignore"
|
||||
version = "0.4.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dbe7873dab538a9a44ad79ede1faf5f30d49f9a5c883ddbab48bce81b64b7492"
|
||||
dependencies = [
|
||||
"globset",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"memchr",
|
||||
"regex",
|
||||
"same-file",
|
||||
"thread_local",
|
||||
"walkdir",
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.8.2"
|
||||
|
|
@ -2439,7 +2488,7 @@ version = "1.8.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"aho-corasick 1.0.1",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
|
@ -2956,12 +3005,12 @@ dependencies = [
|
|||
"ansi_term",
|
||||
"colored",
|
||||
"fuzzy-matcher",
|
||||
"ignore",
|
||||
"pretty-bytes",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"strip-ansi-escapes",
|
||||
"unicode-width",
|
||||
"walkdir",
|
||||
"zellij-tile",
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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,10 +64,12 @@ impl Search {
|
|||
}
|
||||
}
|
||||
pub fn scan_hd(&mut self) {
|
||||
for entry in WalkDir::new(ROOT).into_iter().filter_map(|e| e.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) {
|
||||
let search_results_limit = 100; // artificial limit to prevent probably unwanted chaos
|
||||
// let mut matcher = SkimMatcherV2::default().use_cache(true).element_limit(search_results_limit);
|
||||
|
|
@ -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(),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use zellij_utils::notify_debouncer_full::{
|
|||
};
|
||||
use zellij_utils::{data::Event, errors::prelude::Result};
|
||||
|
||||
const DEBOUNCE_DURATION_MS: u64 = 500;
|
||||
const DEBOUNCE_DURATION_MS: u64 = 400;
|
||||
|
||||
pub fn watch_filesystem(
|
||||
senders: ThreadSenders,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue