diff options
author | Norbert Preining <norbert@preining.info> | 2022-05-26 03:01:06 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2022-05-26 03:01:06 +0000 |
commit | 02d941fa9c9895bb08a84ac9afe3559abd1ba8ad (patch) | |
tree | 481d1d368c6d295a779b590d23bcd5397bcba628 /support/texlab/src/syntax/latex/analysis/distro_file.rs | |
parent | f01a37f8311f33e32441d25bdadcda9dcdbd165d (diff) |
CTAN sync 202205260301
Diffstat (limited to 'support/texlab/src/syntax/latex/analysis/distro_file.rs')
-rw-r--r-- | support/texlab/src/syntax/latex/analysis/distro_file.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/support/texlab/src/syntax/latex/analysis/distro_file.rs b/support/texlab/src/syntax/latex/analysis/distro_file.rs index 4c747ce760..f278c33627 100644 --- a/support/texlab/src/syntax/latex/analysis/distro_file.rs +++ b/support/texlab/src/syntax/latex/analysis/distro_file.rs @@ -1,6 +1,8 @@ -use crate::{distro::Resolver, Uri}; +use lsp_types::Url; -pub fn resolve_distro_file(resolver: &Resolver, stem: &str, extensions: &[&str]) -> Option<Uri> { +use crate::distro::Resolver; + +pub fn resolve_distro_file(resolver: &Resolver, stem: &str, extensions: &[&str]) -> Option<Url> { let mut document = resolver.files_by_name.get(stem); for extension in extensions { document = document.or_else(|| { @@ -8,7 +10,7 @@ pub fn resolve_distro_file(resolver: &Resolver, stem: &str, extensions: &[&str]) resolver.files_by_name.get(full_name.as_str()) }); } - document.and_then(|path| Uri::from_file_path(path).ok()) + document.and_then(|path| Url::from_file_path(path).ok()) } #[cfg(test)] @@ -31,12 +33,12 @@ mod tests { assert_eq!( resolve_distro_file(&resolver, "foo", &["tex"]), - Some(Uri::from_file_path("C:/distro/foo.tex").unwrap()) + Some(Url::from_file_path("C:/distro/foo.tex").unwrap()) ); assert_eq!( resolve_distro_file(&resolver, "foo", &["sty"]), - Some(Uri::from_file_path("C:/distro/foo.sty").unwrap()) + Some(Url::from_file_path("C:/distro/foo.sty").unwrap()) ); assert_eq!(resolve_distro_file(&resolver, "foo", &["cls"]), None); @@ -58,12 +60,12 @@ mod tests { assert_eq!( resolve_distro_file(&resolver, "foo", &["tex"]), - Some(Uri::from_file_path("/distro/foo.tex").unwrap()) + Some(Url::from_file_path("/distro/foo.tex").unwrap()) ); assert_eq!( resolve_distro_file(&resolver, "foo", &["sty"]), - Some(Uri::from_file_path("/distro/foo.sty").unwrap()) + Some(Url::from_file_path("/distro/foo.sty").unwrap()) ); assert_eq!(resolve_distro_file(&resolver, "foo", &["cls"]), None); |