aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Davis2022-02-19 10:51:14 +0000
committerBlaž Hrastnik2022-03-10 08:31:57 +0000
commit6fcab90d16f9493c0c4738312061a26e473ab12a (patch)
treeb06f59ecb48f5ba6e518ec79438b8c82bfba903c
parenta229f405cc0d9690fc9ceca99fce0832b3e060ab (diff)
only fetch git-sourced grammars
This is a bit of a micro-optimization: in the current setup we waste a thread in the pool for a local grammar only to println! a message saying we're skipping fetching because it's a local grammar.
-rw-r--r--helix-loader/src/grammar.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/helix-loader/src/grammar.rs b/helix-loader/src/grammar.rs
index a0aa9583..b7a3cfcf 100644
--- a/helix-loader/src/grammar.rs
+++ b/helix-loader/src/grammar.rs
@@ -76,7 +76,11 @@ pub fn get_language(name: &str) -> Result<Language> {
}
pub fn fetch_grammars() -> Result<()> {
- run_parallel(get_grammar_configs()?, fetch_grammar, "fetch")
+ // We do not need to fetch local grammars.
+ let mut grammars = get_grammar_configs()?;
+ grammars.retain(|grammar| !matches!(grammar.source, GrammarSource::Local { .. }));
+
+ run_parallel(grammars, fetch_grammar, "fetch")
}
pub fn build_grammars() -> Result<()> {
@@ -172,15 +176,12 @@ fn fetch_grammar(grammar: GrammarConfiguration) -> Result<()> {
"Grammar '{}' checked out at '{}'.",
grammar.grammar_id, revision
);
- Ok(())
} else {
println!("Grammar '{}' is already up to date.", grammar.grammar_id);
- Ok(())
}
- } else {
- println!("Skipping local grammar '{}'", grammar.grammar_id);
- Ok(())
}
+
+ Ok(())
}
// Sets the remote for a repository to the given URL, creating the remote if