Warn when building assets from files if some referenced contexts are missing

This commit is contained in:
Keith Hall 2021-08-01 22:40:15 +03:00
parent 5f5b77cdda
commit 50e1c6074f
3 changed files with 15 additions and 6 deletions

8
Cargo.lock generated
View File

@ -381,9 +381,9 @@ dependencies = [
[[package]] [[package]]
name = "fancy-regex" name = "fancy-regex"
version = "0.3.5" version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae91abf6555234338687bb47913978d275539235fcb77ba9863b779090b42b14" checksum = "9d6b8560a05112eb52f04b00e5d3790c0dd75d9d980eb8a122fb23b92a623ccf"
dependencies = [ dependencies = [
"bit-set", "bit-set",
"regex", "regex",
@ -1088,9 +1088,9 @@ dependencies = [
[[package]] [[package]]
name = "syntect" name = "syntect"
version = "4.5.0" version = "4.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bfac2b23b4d049dc9a89353b4e06bbc85a8f42020cccbe5409a115cf19031e5" checksum = "8b20815bbe80ee0be06e6957450a841185fcf690fe0178f14d77a05ce2caa031"
dependencies = [ dependencies = [
"bincode", "bincode",
"bitflags", "bitflags",

View File

@ -60,7 +60,7 @@ optional = true
default-features = false default-features = false
[dependencies.syntect] [dependencies.syntect]
version = "4.5.0" version = "4.6.0"
default-features = false default-features = false
features = ["parsing", "yaml-load", "dump-load", "dump-create"] features = ["parsing", "yaml-load", "dump-load", "dump-create"]

View File

@ -111,8 +111,17 @@ impl HighlightingAssets {
); );
} }
let syntax_set = syntax_set_builder.build();
let missing_contexts = syntax_set.find_unlinked_contexts();
if !missing_contexts.is_empty() {
println!("Some referenced contexts could not be found!");
for context in missing_contexts {
println!("- {}", context);
}
}
Ok(HighlightingAssets::new( Ok(HighlightingAssets::new(
Some(syntax_set_builder.build()), Some(syntax_set),
None, None,
theme_set, theme_set,
)) ))