mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Improve logging
This commit is contained in:
parent
ee4d904cfb
commit
56df0fc83c
6 changed files with 41 additions and 18 deletions
|
@ -1,7 +1,6 @@
|
|||
pub(crate) mod input;
|
||||
|
||||
use std::{
|
||||
fmt,
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
|
@ -17,17 +16,11 @@ use crate::{
|
|||
FileId,
|
||||
};
|
||||
|
||||
#[derive(Default)]
|
||||
#[derive(Default, Debug)]
|
||||
pub(crate) struct RootDatabase {
|
||||
runtime: salsa::Runtime<RootDatabase>,
|
||||
}
|
||||
|
||||
impl fmt::Debug for RootDatabase {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.write_str("RootDatabase { ... }")
|
||||
}
|
||||
}
|
||||
|
||||
impl salsa::Database for RootDatabase {
|
||||
fn salsa_runtime(&self) -> &salsa::Runtime<RootDatabase> {
|
||||
&self.runtime
|
||||
|
|
|
@ -98,6 +98,8 @@ impl AnalysisHostImpl {
|
|||
}
|
||||
}
|
||||
pub fn apply_change(&mut self, change: AnalysisChange) {
|
||||
log::info!("apply_change {:?}", change);
|
||||
|
||||
for (file_id, text) in change.files_changed {
|
||||
self.db
|
||||
.query(db::input::FileTextQuery)
|
||||
|
|
|
@ -13,7 +13,7 @@ mod symbol_index;
|
|||
mod completion;
|
||||
|
||||
use std::{
|
||||
fmt::Debug,
|
||||
fmt,
|
||||
sync::Arc,
|
||||
collections::BTreeMap,
|
||||
};
|
||||
|
@ -60,12 +60,12 @@ pub struct CrateGraph {
|
|||
pub crate_roots: BTreeMap<CrateId, FileId>,
|
||||
}
|
||||
|
||||
pub trait FileResolver: Debug + Send + Sync + 'static {
|
||||
pub trait FileResolver: fmt::Debug + Send + Sync + 'static {
|
||||
fn file_stem(&self, file_id: FileId) -> String;
|
||||
fn resolve(&self, file_id: FileId, path: &RelativePath) -> Option<FileId>;
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
#[derive(Default)]
|
||||
pub struct AnalysisChange {
|
||||
files_added: Vec<(FileId, String)>,
|
||||
files_changed: Vec<(FileId, String)>,
|
||||
|
@ -75,6 +75,19 @@ pub struct AnalysisChange {
|
|||
file_resolver: Option<FileResolverImp>,
|
||||
}
|
||||
|
||||
impl fmt::Debug for AnalysisChange {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt.debug_struct("AnalysisChange")
|
||||
.field("files_added", &self.files_added.len())
|
||||
.field("files_changed", &self.files_changed.len())
|
||||
.field("files_removed", &self.files_removed.len())
|
||||
.field("libraries_added", &self.libraries_added.len())
|
||||
.field("crate_graph", &self.crate_graph)
|
||||
.field("file_resolver", &self.file_resolver)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
impl AnalysisChange {
|
||||
pub fn new() -> AnalysisChange {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue