aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide/src')
-rw-r--r--crates/ide/src/view_crate_graph.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/crates/ide/src/view_crate_graph.rs b/crates/ide/src/view_crate_graph.rs
index 527a5ae0d..5e4ba881e 100644
--- a/crates/ide/src/view_crate_graph.rs
+++ b/crates/ide/src/view_crate_graph.rs
@@ -5,7 +5,7 @@ use std::{
5 sync::Arc, 5 sync::Arc,
6}; 6};
7 7
8use dot::Id; 8use dot::{Id, LabelText};
9use ide_db::{ 9use ide_db::{
10 base_db::{CrateGraph, CrateId, Dependency, SourceDatabase, SourceDatabaseExt}, 10 base_db::{CrateGraph, CrateId, Dependency, SourceDatabase, SourceDatabaseExt},
11 RootDatabase, 11 RootDatabase,
@@ -97,7 +97,15 @@ impl<'a> dot::Labeller<'a, CrateId, Edge<'a>> for DotCrateGraph {
97 } 97 }
98 98
99 fn node_id(&'a self, n: &CrateId) -> Id<'a> { 99 fn node_id(&'a self, n: &CrateId) -> Id<'a> {
100 let name = self.graph[*n].display_name.as_ref().map_or("_missing_name_", |name| &*name); 100 Id::new(format!("_{}", n.0)).unwrap()
101 Id::new(format!("{}_{}", name, n.0)).unwrap() 101 }
102
103 fn node_shape(&'a self, _node: &CrateId) -> Option<LabelText<'a>> {
104 Some(LabelText::LabelStr("box".into()))
105 }
106
107 fn node_label(&'a self, n: &CrateId) -> LabelText<'a> {
108 let name = self.graph[*n].display_name.as_ref().map_or("(unnamed crate)", |name| &*name);
109 LabelText::LabelStr(name.into())
102 } 110 }
103} 111}