mirror of
https://github.com/sharkdp/bat
synced 2026-08-01 18:31:46 +00:00
When returning a SyntaxReference, also return the SyntaxSet that contains it (#1776)
To improve startup performance, we will later load smaller `SyntaxSet`s instead of one giant one. However, the current API assumes only one `SyntaxSet` is ever used, and that that implicitly is the `SyntaxSet` from which returned `SyntaxReference`s comes. This change changes the API to reflect that `SyntaxSet` and `SyntaxReference` are tightly coupled, and enables the use of several `SyntaxSet`.
This commit is contained in:
+3
-3
@@ -101,11 +101,11 @@ pub fn get_languages(config: &Config) -> Result<String> {
|
||||
true
|
||||
} else {
|
||||
let test_file = Path::new("test").with_extension(extension);
|
||||
let syntax = assets
|
||||
let syntax_in_set = assets
|
||||
.get_syntax_for_file_name(test_file, &config.syntax_mapping)
|
||||
.unwrap(); // safe since .get_syntaxes() above worked
|
||||
match syntax {
|
||||
Some(syntax) => syntax.name == lang_name,
|
||||
match syntax_in_set {
|
||||
Some(syntax_in_set) => syntax_in_set.syntax.name == lang_name,
|
||||
None => false,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user