Skip to content

Commit

Permalink
Handle unknown packages in preview
Browse files Browse the repository at this point in the history
  • Loading branch information
pfoerster committed Jun 14, 2019
1 parent 4e802bb commit 2c2663f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/hover/latex_preview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use image::DynamicImage;
use image::GenericImageView;
use lsp_types::*;
use std::borrow::Cow;
use std::ffi::OsString;
use std::io::Cursor;
use std::process::{Command, Stdio};
use std::time::Duration;
Expand Down Expand Up @@ -127,6 +128,13 @@ impl LatexPreviewHoverProvider {
.iter()
.filter(|include| include.kind() == LatexIncludeKind::Package)
.filter(|include| !IGNORED_PACKAGES.contains(&include.path().text()))
.filter(|include| {
let name = format!("{}.sty", include.path().text());
request
.resolver
.files_by_name
.contains_key(&OsString::from(name))
})
.for_each(|include| {
code.push_str(&Self::extract_text(&text, include.command.range));
code.push('\n');
Expand Down

0 comments on commit 2c2663f

Please sign in to comment.