Allow syntax detection to fail
This commit is contained in:
parent
4f0ce39f3e
commit
3444b30d7e
1 changed files with 11 additions and 3 deletions
|
|
@ -90,10 +90,18 @@ fn main() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let syntax = match ps.find_syntax_for_file(&path).unwrap() {
|
let syntax = match ps.find_syntax_for_file(&path) {
|
||||||
Some(some) => some,
|
Ok(Some(some)) => some,
|
||||||
None => ps.find_syntax_plain_text(),
|
Ok(None) => {
|
||||||
|
log::warn!("no syntax found for {:?}", path);
|
||||||
|
ps.find_syntax_plain_text()
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
log::warn!("failed to determine syntax for {:?}: {:?}", path, err);
|
||||||
|
ps.find_syntax_plain_text()
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
log::info!("using syntax {:?}", syntax.name);
|
||||||
|
|
||||||
buffer.lines.clear();
|
buffer.lines.clear();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue