diff options
Diffstat (limited to 'crates/ra_analysis/src/lib.rs')
-rw-r--r-- | crates/ra_analysis/src/lib.rs | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs index c7e7dc1c0..85df9c089 100644 --- a/crates/ra_analysis/src/lib.rs +++ b/crates/ra_analysis/src/lib.rs | |||
@@ -30,7 +30,7 @@ use crate::{ | |||
30 | }; | 30 | }; |
31 | 31 | ||
32 | pub use crate::{ | 32 | pub use crate::{ |
33 | completion::CompletionItem, | 33 | completion::{CompletionItem, CompletionItemKind, InsertText}, |
34 | }; | 34 | }; |
35 | pub use ra_editor::{ | 35 | pub use ra_editor::{ |
36 | FileSymbol, Fold, FoldKind, HighlightedRange, LineIndex, Runnable, RunnableKind, StructureNode, | 36 | FileSymbol, Fold, FoldKind, HighlightedRange, LineIndex, Runnable, RunnableKind, StructureNode, |
@@ -72,13 +72,23 @@ struct RemoveFile { | |||
72 | 72 | ||
73 | impl fmt::Debug for AnalysisChange { | 73 | impl fmt::Debug for AnalysisChange { |
74 | fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | 74 | fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { |
75 | fmt.debug_struct("AnalysisChange") | 75 | let mut d = fmt.debug_struct("AnalysisChange"); |
76 | .field("new_roots", &self.new_roots) | 76 | if !self.new_roots.is_empty() { |
77 | .field("roots_changed", &self.roots_changed) | 77 | d.field("new_roots", &self.new_roots); |
78 | .field("files_changed", &self.files_changed.len()) | 78 | } |
79 | .field("libraries_added", &self.libraries_added.len()) | 79 | if !self.roots_changed.is_empty() { |
80 | .field("crate_graph", &self.crate_graph) | 80 | d.field("roots_changed", &self.roots_changed); |
81 | .finish() | 81 | } |
82 | if !self.files_changed.is_empty() { | ||
83 | d.field("files_changed", &self.files_changed.len()); | ||
84 | } | ||
85 | if !self.libraries_added.is_empty() { | ||
86 | d.field("libraries_added", &self.libraries_added.len()); | ||
87 | } | ||
88 | if !self.crate_graph.is_some() { | ||
89 | d.field("crate_graph", &self.crate_graph); | ||
90 | } | ||
91 | d.finish() | ||
82 | } | 92 | } |
83 | } | 93 | } |
84 | 94 | ||
@@ -358,13 +368,22 @@ impl Analysis { | |||
358 | } | 368 | } |
359 | } | 369 | } |
360 | 370 | ||
361 | #[derive(Debug)] | ||
362 | pub struct LibraryData { | 371 | pub struct LibraryData { |
363 | root_id: SourceRootId, | 372 | root_id: SourceRootId, |
364 | root_change: RootChange, | 373 | root_change: RootChange, |
365 | symbol_index: SymbolIndex, | 374 | symbol_index: SymbolIndex, |
366 | } | 375 | } |
367 | 376 | ||
377 | impl fmt::Debug for LibraryData { | ||
378 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | ||
379 | f.debug_struct("LibraryData") | ||
380 | .field("root_id", &self.root_id) | ||
381 | .field("root_change", &self.root_change) | ||
382 | .field("n_symbols", &self.symbol_index.len()) | ||
383 | .finish() | ||
384 | } | ||
385 | } | ||
386 | |||
368 | impl LibraryData { | 387 | impl LibraryData { |
369 | pub fn prepare( | 388 | pub fn prepare( |
370 | root_id: SourceRootId, | 389 | root_id: SourceRootId, |