mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 21:35:20 +00:00
switch analysis to vfs
This commit is contained in:
parent
815a0e5778
commit
85290bc134
8 changed files with 142 additions and 100 deletions
|
@ -4,7 +4,7 @@ use relative_path::{RelativePathBuf};
|
|||
use test_utils::{extract_offset, parse_fixture, CURSOR_MARKER};
|
||||
use ra_db::mock::FileMap;
|
||||
|
||||
use crate::{Analysis, AnalysisChange, AnalysisHost, FileId, FilePosition};
|
||||
use crate::{Analysis, AnalysisChange, AnalysisHost, FileId, FilePosition, WORKSPACE};
|
||||
|
||||
/// Mock analysis is used in test to bootstrap an AnalysisHost/Analysis
|
||||
/// from a set of in-memory files.
|
||||
|
@ -82,10 +82,10 @@ impl MockAnalysis {
|
|||
for (path, contents) in self.files.into_iter() {
|
||||
assert!(path.starts_with('/'));
|
||||
let path = RelativePathBuf::from_path(&path[1..]).unwrap();
|
||||
let file_id = file_map.add(path);
|
||||
change.add_file(file_id, contents);
|
||||
let file_id = file_map.add(path.clone());
|
||||
change.add_file(WORKSPACE, file_id, path, Arc::new(contents));
|
||||
}
|
||||
change.set_file_resolver(Arc::new(file_map));
|
||||
// change.set_file_resolver(Arc::new(file_map));
|
||||
host.apply_change(change);
|
||||
host
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue