@@ -10,7 +10,7 @@ use ide_db::{
10
10
debug:: { DebugQueryTable , TableEntry } ,
11
11
Query , QueryTable ,
12
12
} ,
13
- CrateId , FileId , FileTextQuery , ParseQuery , SourceDatabase , SourceRootId ,
13
+ CrateData , FileId , FileTextQuery , ParseQuery , SourceDatabase , SourceRootId ,
14
14
} ,
15
15
symbol_index:: ModuleSymbolsQuery ,
16
16
} ;
@@ -54,25 +54,54 @@ pub(crate) fn status(db: &RootDatabase, file_id: Option<FileId>) -> String {
54
54
format_to ! ( buf, "{} block def maps\n " , collect_query_count( BlockDefMapQuery . in_db( db) ) ) ;
55
55
56
56
if let Some ( file_id) = file_id {
57
- format_to ! ( buf, "\n File info :\n " ) ;
57
+ format_to ! ( buf, "\n Crates for file {} :\n " , file_id . index ( ) ) ;
58
58
let crates = crate :: parent_module:: crates_for ( db, file_id) ;
59
59
if crates. is_empty ( ) {
60
60
format_to ! ( buf, "Does not belong to any crate" ) ;
61
61
}
62
62
let crate_graph = db. crate_graph ( ) ;
63
- for krate in crates {
64
- let display_crate = |krate : CrateId | match & crate_graph[ krate] . display_name {
65
- Some ( it) => format ! ( "{it}({})" , krate. into_raw( ) ) ,
66
- None => format ! ( "{}" , krate. into_raw( ) ) ,
67
- } ;
68
- format_to ! ( buf, "Crate: {}\n " , display_crate( krate) ) ;
69
- format_to ! ( buf, "Enabled cfgs: {:?}\n " , crate_graph[ krate] . cfg_options) ;
70
- let deps = crate_graph[ krate]
71
- . dependencies
63
+ for crate_id in crates {
64
+ let CrateData {
65
+ root_file_id,
66
+ edition,
67
+ version,
68
+ display_name,
69
+ cfg_options,
70
+ potential_cfg_options,
71
+ env,
72
+ dependencies,
73
+ origin,
74
+ is_proc_macro,
75
+ target_layout,
76
+ toolchain,
77
+ } = & crate_graph[ crate_id] ;
78
+ format_to ! (
79
+ buf,
80
+ "Crate: {}\n " ,
81
+ match display_name {
82
+ Some ( it) => format!( "{it}({})" , crate_id. into_raw( ) ) ,
83
+ None => format!( "{}" , crate_id. into_raw( ) ) ,
84
+ }
85
+ ) ;
86
+ format_to ! ( buf, " Root module file id: {}\n " , root_file_id. index( ) ) ;
87
+ format_to ! ( buf, " Edition: {}\n " , edition) ;
88
+ format_to ! ( buf, " Version: {}\n " , version. as_deref( ) . unwrap_or( "n/a" ) ) ;
89
+ format_to ! ( buf, " Enabled cfgs: {:?}\n " , cfg_options) ;
90
+ format_to ! ( buf, " Potential cfgs: {:?}\n " , potential_cfg_options) ;
91
+ format_to ! ( buf, " Env: {:?}\n " , env) ;
92
+ format_to ! ( buf, " Origin: {:?}\n " , origin) ;
93
+ format_to ! ( buf, " Is a proc macro crate: {}\n " , is_proc_macro) ;
94
+ format_to ! ( buf, " Workspace Target Layout: {:?}\n " , target_layout) ;
95
+ format_to ! (
96
+ buf,
97
+ " Workspace Toolchain: {}\n " ,
98
+ toolchain. as_ref( ) . map_or_else( || "n/a" . into( ) , |v| v. to_string( ) )
99
+ ) ;
100
+ let deps = dependencies
72
101
. iter ( )
73
- . map ( |dep| format ! ( "{}={:? }" , dep. name, dep. crate_id) )
102
+ . map ( |dep| format ! ( "{}={}" , dep. name, dep. crate_id. into_raw ( ) ) )
74
103
. format ( ", " ) ;
75
- format_to ! ( buf, "Dependencies: {}\n " , deps) ;
104
+ format_to ! ( buf, " Dependencies: {}\n " , deps) ;
76
105
}
77
106
}
78
107
0 commit comments