blob: b821dcf6e189193de8e7bb243ed807d0c1555bdf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
use base_db::{FeatureParams, Workspace};
use lsp_types::{DocumentLink, Url};
use crate::util::line_index_ext::LineIndexExt;
pub fn find_all(workspace: &Workspace, uri: &Url) -> Option<Vec<DocumentLink>> {
let document = workspace.lookup(uri)?;
let links = links::find_links(FeatureParams::new(workspace, document)).into_iter();
let links = links.filter_map(|link| {
Some(lsp_types::DocumentLink {
data: None,
tooltip: None,
target: Some(link.document.uri.clone()),
range: document.line_index.line_col_lsp_range(link.range)?,
})
});
Some(links.collect())
}
|