Skip to content

Commit

Permalink
feat(plugins): strider improvements (#2551)
Browse files Browse the repository at this point in the history
* fix(plugins): adjust debounce and smart file ignore in strider

* style(comment): remove commented code

* style(fmt): rustfmt
  • Loading branch information
imsnif committed Jun 17, 2023
1 parent 29a391f commit 805fd1d
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 12 deletions.
53 changes: 51 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion default-plugins/strider/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 6 additions & 8 deletions default-plugins/strider/src/search/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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(),
)
Expand Down
2 changes: 1 addition & 1 deletion zellij-server/src/plugins/watch_filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 805fd1d

Please sign in to comment.