aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_analysis/src/lib.rs')
-rw-r--r--crates/ra_analysis/src/lib.rs19
1 files changed, 16 insertions, 3 deletions
diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs
index 4a1ae3b64..703938cf9 100644
--- a/crates/ra_analysis/src/lib.rs
+++ b/crates/ra_analysis/src/lib.rs
@@ -13,7 +13,7 @@ mod symbol_index;
13mod completion; 13mod completion;
14 14
15use std::{ 15use std::{
16 fmt::Debug, 16 fmt,
17 sync::Arc, 17 sync::Arc,
18 collections::BTreeMap, 18 collections::BTreeMap,
19}; 19};
@@ -60,12 +60,12 @@ pub struct CrateGraph {
60 pub crate_roots: BTreeMap<CrateId, FileId>, 60 pub crate_roots: BTreeMap<CrateId, FileId>,
61} 61}
62 62
63pub trait FileResolver: Debug + Send + Sync + 'static { 63pub trait FileResolver: fmt::Debug + Send + Sync + 'static {
64 fn file_stem(&self, file_id: FileId) -> String; 64 fn file_stem(&self, file_id: FileId) -> String;
65 fn resolve(&self, file_id: FileId, path: &RelativePath) -> Option<FileId>; 65 fn resolve(&self, file_id: FileId, path: &RelativePath) -> Option<FileId>;
66} 66}
67 67
68#[derive(Debug, Default)] 68#[derive(Default)]
69pub struct AnalysisChange { 69pub struct AnalysisChange {
70 files_added: Vec<(FileId, String)>, 70 files_added: Vec<(FileId, String)>,
71 files_changed: Vec<(FileId, String)>, 71 files_changed: Vec<(FileId, String)>,
@@ -75,6 +75,19 @@ pub struct AnalysisChange {
75 file_resolver: Option<FileResolverImp>, 75 file_resolver: Option<FileResolverImp>,
76} 76}
77 77
78impl fmt::Debug for AnalysisChange {
79 fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
80 fmt.debug_struct("AnalysisChange")
81 .field("files_added", &self.files_added.len())
82 .field("files_changed", &self.files_changed.len())
83 .field("files_removed", &self.files_removed.len())
84 .field("libraries_added", &self.libraries_added.len())
85 .field("crate_graph", &self.crate_graph)
86 .field("file_resolver", &self.file_resolver)
87 .finish()
88 }
89}
90
78 91
79impl AnalysisChange { 92impl AnalysisChange {
80 pub fn new() -> AnalysisChange { 93 pub fn new() -> AnalysisChange {