@@ -1,6 +1,7 @@
11use directories::ProjectDirs;
22use errors::*;
33use std::borrow::Cow;
4+use std::collections::BTreeMap;
45use std::fs::{self, File};
56use std::path::{Path, PathBuf};
67use syntect::dumps::{dump_to_file, from_binary, from_reader};
@@ -25,10 +26,27 @@ impl HighlightingAssets {
2526 Self::from_cache().unwrap_or_else(|_| Self::from_binary())
2627 }
2728
28− pub fn from_files(dir: Option<&Path>) -> Result<Self> {
29+ fn empty() -> Self {
30+ let mut syntax_set = SyntaxSet::new();
31+ syntax_set.load_plain_text_syntax();
32+
33+ let theme_set = ThemeSet {
34+ themes: BTreeMap::new(),
35+ };
36+ HighlightingAssets {
37+ syntax_set,
38+ theme_set,
39+ }
40+ }
41+
42+ pub fn from_files(dir: Option<&Path>, start_empty: bool) -> Result<Self> {
2943 let source_dir = dir.unwrap_or_else(|| PROJECT_DIRS.config_dir());
3044
31− let mut assets = Self::from_binary_unlinked();
45+ let mut assets = if start_empty {
46+ Self::empty()
47+ } else {
48+ Self::from_binary_unlinked()
49+ };
3250
3351 let theme_dir = source_dir.join("themes");
3452