summaryrefslogtreecommitdiff
path: root/support/texlab/crates/links/src/include.rs
diff options
context:
space:
mode:
Diffstat (limited to 'support/texlab/crates/links/src/include.rs')
-rw-r--r--support/texlab/crates/links/src/include.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/support/texlab/crates/links/src/include.rs b/support/texlab/crates/links/src/include.rs
new file mode 100644
index 0000000000..374e0089df
--- /dev/null
+++ b/support/texlab/crates/links/src/include.rs
@@ -0,0 +1,26 @@
+use base_db::{DocumentLocation, FeatureParams};
+
+pub(super) fn find_links<'a>(
+ params: FeatureParams<'a>,
+ results: &mut Vec<DocumentLocation<'a>>,
+) -> Option<()> {
+ let document = params.document;
+ let parent = *params
+ .workspace
+ .parents(document)
+ .iter()
+ .next()
+ .unwrap_or(&document);
+
+ let graph = base_db::graph::Graph::new(params.workspace, parent);
+
+ for edge in &graph.edges {
+ if edge.source == document {
+ if let Some(weight) = &edge.weight {
+ results.push(DocumentLocation::new(edge.target, weight.link.path.range));
+ }
+ }
+ }
+
+ Some(())
+}