mirror of
https://github.com/latex-lsp/texlab.git
synced 2025-08-04 02:39:21 +00:00
Handle subfiles package in forward search module
This commit is contained in:
parent
629704a2bd
commit
f5d50497a7
2 changed files with 26 additions and 5 deletions
|
@ -191,10 +191,28 @@ impl Snapshot {
|
|||
options: &Options,
|
||||
current_dir: &Path,
|
||||
) -> Option<Arc<Document>> {
|
||||
for document in self.relations(uri, options, current_dir) {
|
||||
if let DocumentContent::Latex(table) = &document.content {
|
||||
for doc in self.relations(uri, options, current_dir) {
|
||||
if let DocumentContent::Latex(table) = &doc.content {
|
||||
if table.is_standalone {
|
||||
return Some(document);
|
||||
return Some(doc);
|
||||
}
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
pub fn parent_subfile(
|
||||
&self,
|
||||
uri: &Uri,
|
||||
options: &Options,
|
||||
current_dir: &Path,
|
||||
) -> Option<Arc<Document>> {
|
||||
for doc in self.relations(uri, options, current_dir) {
|
||||
if let DocumentContent::Latex(table) = &doc.content {
|
||||
if table.is_standalone
|
||||
&& !table.components.iter().any(|comp| comp == "subfiles.cls")
|
||||
{
|
||||
return Some(doc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -452,7 +470,10 @@ impl Workspace {
|
|||
if let Ok(mut path) = uri.to_file_path() {
|
||||
while path.pop() {
|
||||
let snapshot = self.get().await;
|
||||
if snapshot.parent(&uri, &options, &self.current_dir).is_some() {
|
||||
if snapshot
|
||||
.parent_subfile(&uri, &options, &self.current_dir)
|
||||
.is_some()
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ pub async fn search<'a>(
|
|||
) -> Option<ForwardSearchResult> {
|
||||
let pdf_path = snapshot
|
||||
.resolve_aux_targets(
|
||||
&snapshot.parent(tex_uri, options, current_dir)?.uri,
|
||||
&snapshot.parent_subfile(tex_uri, options, current_dir)?.uri,
|
||||
options,
|
||||
current_dir,
|
||||
"pdf",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue