mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 09:27:27 +00:00
Preserve order when grouping references.
This commit is contained in:
parent
0583919919
commit
af1aa86ac0
1 changed files with 16 additions and 11 deletions
|
@ -212,7 +212,7 @@ impl LsifManager<'_> {
|
||||||
in_v: result_id.into(),
|
in_v: result_id.into(),
|
||||||
out_v: result_set_id.into(),
|
out_v: result_set_id.into(),
|
||||||
}));
|
}));
|
||||||
let edges = token.references.iter().fold(
|
let mut edges = token.references.iter().fold(
|
||||||
HashMap::<_, Vec<lsp_types::NumberOrString>>::new(),
|
HashMap::<_, Vec<lsp_types::NumberOrString>>::new(),
|
||||||
|mut edges, x| {
|
|mut edges, x| {
|
||||||
let entry =
|
let entry =
|
||||||
|
@ -221,16 +221,21 @@ impl LsifManager<'_> {
|
||||||
edges
|
edges
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
for ((file_id, is_definition), vertices) in edges.into_iter() {
|
for x in token.references {
|
||||||
self.add_edge(lsif::Edge::Item(lsif::Item {
|
if let Some(vertices) = edges.remove(&(x.range.file_id, x.is_definition)) {
|
||||||
document: (*self.file_map.get(&file_id).unwrap()).into(),
|
self.add_edge(lsif::Edge::Item(lsif::Item {
|
||||||
property: Some(if is_definition {
|
document: (*self.file_map.get(&x.range.file_id).unwrap()).into(),
|
||||||
lsif::ItemKind::Definitions
|
property: Some(if x.is_definition {
|
||||||
} else {
|
lsif::ItemKind::Definitions
|
||||||
lsif::ItemKind::References
|
} else {
|
||||||
}),
|
lsif::ItemKind::References
|
||||||
edge_data: lsif::EdgeDataMultiIn { in_vs: vertices, out_v: result_id.into() },
|
}),
|
||||||
}));
|
edge_data: lsif::EdgeDataMultiIn {
|
||||||
|
in_vs: vertices,
|
||||||
|
out_v: result_id.into(),
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue