diff options
author | Martin Nordholts <enselic@gmail.com> | 2022-05-07 13:43:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-07 13:43:11 +0200 |
commit | 7334ab45422882686212ed31df2d95c02e7585f1 (patch) | |
tree | 4b47bb8a2b21d15211a2e20687d72ca2388ebe0a /src/assets.rs | |
parent | 719248f1c1a2c1c6723b941d3a58cafccf6e3739 (diff) |
Bump to syntect 5.0.0 to e.g. start lazy-loading syntaxes (#2181)
* Bump to syntect 5.0.0 to e.g. start lazy-loading themes
Closes #915
Closes #951
Closes #1846
Closes #1854
* Typo fix formated -> formatted
* Update CHANGELOG.md
Diffstat (limited to 'src/assets.rs')
-rw-r--r-- | src/assets.rs | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/assets.rs b/src/assets.rs index e25c233f..81268433 100644 --- a/src/assets.rs +++ b/src/assets.rs @@ -43,8 +43,9 @@ pub struct SyntaxReferenceInSet<'a> { pub syntax_set: &'a SyntaxSet, } -/// Compress for size of ~700 kB instead of ~4600 kB at the cost of ~30% longer deserialization time -pub(crate) const COMPRESS_SYNTAXES: bool = true; +/// Lazy-loaded syntaxes are already compressed, and we don't want to compress +/// already compressed data. +pub(crate) const COMPRESS_SYNTAXES: bool = false; /// We don't want to compress our [LazyThemeSet] since the lazy-loaded themes /// within it are already compressed, and compressing another time just makes @@ -581,13 +582,22 @@ mod tests { } #[test] - fn syntax_detection_is_case_sensitive() { + fn syntax_detection_is_case_insensitive() { let mut test = SyntaxDetectionTest::new(); - assert_ne!(test.syntax_for_file("README.MD"), "Markdown"); + assert_eq!(test.syntax_for_file("README.md"), "Markdown"); + assert_eq!(test.syntax_for_file("README.mD"), "Markdown"); + assert_eq!(test.syntax_for_file("README.Md"), "Markdown"); + assert_eq!(test.syntax_for_file("README.MD"), "Markdown"); + + // Adding a mapping for "MD" in addition to "md" should not break the mapping test.syntax_mapping .insert("*.MD", MappingTarget::MapTo("Markdown")) .ok(); + + assert_eq!(test.syntax_for_file("README.md"), "Markdown"); + assert_eq!(test.syntax_for_file("README.mD"), "Markdown"); + assert_eq!(test.syntax_for_file("README.Md"), "Markdown"); assert_eq!(test.syntax_for_file("README.MD"), "Markdown"); } |