mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 09:26:19 +04:00
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.
This commit is contained in:
parent
a229f405cc
commit
6fcab90d16
@ -76,7 +76,11 @@ pub fn get_language(name: &str) -> Result<Language> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn fetch_grammars() -> Result<()> {
|
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<()> {
|
pub fn build_grammars() -> Result<()> {
|
||||||
@ -172,15 +176,12 @@ fn fetch_grammar(grammar: GrammarConfiguration) -> Result<()> {
|
|||||||
"Grammar '{}' checked out at '{}'.",
|
"Grammar '{}' checked out at '{}'.",
|
||||||
grammar.grammar_id, revision
|
grammar.grammar_id, revision
|
||||||
);
|
);
|
||||||
Ok(())
|
|
||||||
} else {
|
} else {
|
||||||
println!("Grammar '{}' is already up to date.", grammar.grammar_id);
|
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
|
// Sets the remote for a repository to the given URL, creating the remote if
|
||||||
|
Loading…
Reference in New Issue
Block a user