Skip to content

Commit

Permalink
Do not treat links to packages as bidirectional
Browse files Browse the repository at this point in the history
This commits fixes issues related to the project discovery where two
separate projects reference the same local package or document class.

See #679.
  • Loading branch information
pfoerster committed Aug 17, 2022
1 parent 47d3d98 commit 18db6f5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use anyhow::Result;
use crossbeam_channel::Sender;
use lsp_types::Url;
use notify::Watcher;
use petgraph::{graphmap::UnGraphMap, visit::Dfs};
use petgraph::{graphmap::DiGraphMap, visit::Dfs};
use rustc_hash::{FxHashMap, FxHashSet};

use crate::{
Expand Down Expand Up @@ -145,6 +145,14 @@ impl Workspace {
for target in targets {
if let Some(j) = all_uris.iter().position(|uri| uri == target) {
edges.push((i, j, ()));

if target.as_str().ends_with(".tex")
|| target.as_str().ends_with(".bib")
|| target.as_str().ends_with(".rnw")
{
edges.push((j, i, ()));
}

break;
}
}
Expand All @@ -154,7 +162,7 @@ impl Workspace {

let mut slice = self.clone();
slice.documents_by_uri = FxHashMap::default();
let graph = UnGraphMap::from_edges(edges);
let graph = DiGraphMap::from_edges(edges);
let mut dfs = Dfs::new(&graph, start);
while let Some(i) = dfs.next(&graph) {
let uri = &all_uris[i];
Expand Down

0 comments on commit 18db6f5

Please sign in to comment.