From db2c87c78218b3b4b96e8cc7219701635a1105ec Mon Sep 17 00:00:00 2001 From: Vhyrro Date: Sat, 6 May 2023 17:33:43 +0200 Subject: [PATCH] feat(breeze.rs): make `parse_files` take in a number of jobs --- src/breeze.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/breeze.rs b/src/breeze.rs index bd5c268..01423dc 100644 --- a/src/breeze.rs +++ b/src/breeze.rs @@ -29,11 +29,12 @@ fn parse_file(filepath: &std::path::PathBuf, parser: &mut Parser) -> Result, language: Language, + num_jobs: Option, callback: &'static (dyn Fn(Tree) + Send + Sync), ) { let threadpool = Builder::new() .thread_name("neorg".into()) - .num_threads(8) + .num_threads(num_jobs.unwrap_or(4)) .build(); for file in files { @@ -75,6 +76,7 @@ mod tests { parse_files( workspace.files(), tree_sitter_norg::language(), + None, &|tree: Tree| assert!(tree.root_node().kind() == "document"), ); }