mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
internal: Refine CrateOrigin variants
This commit is contained in:
parent
42d671fcb7
commit
31db1fc75f
12 changed files with 343 additions and 235 deletions
|
@ -192,6 +192,7 @@ impl GlobalState {
|
|||
it.clone(),
|
||||
cargo_config.target.as_deref(),
|
||||
&cargo_config.extra_env,
|
||||
None,
|
||||
))
|
||||
}
|
||||
})
|
||||
|
@ -427,19 +428,19 @@ impl GlobalState {
|
|||
let (crate_graph, proc_macro_paths) = {
|
||||
let vfs = &mut self.vfs.write().0;
|
||||
let loader = &mut self.loader;
|
||||
let mem_docs = &self.mem_docs;
|
||||
let mut load = move |path: &AbsPath| {
|
||||
let mut load = |path: &AbsPath| {
|
||||
let _p = profile::span("switch_workspaces::load");
|
||||
let vfs_path = vfs::VfsPath::from(path.to_path_buf());
|
||||
if !mem_docs.contains(&vfs_path) {
|
||||
let contents = loader.handle.load_sync(path);
|
||||
vfs.set_file_contents(vfs_path.clone(), contents);
|
||||
match vfs.file_id(&vfs_path) {
|
||||
Some(file_id) => Some(file_id),
|
||||
None => {
|
||||
if !self.mem_docs.contains(&vfs_path) {
|
||||
let contents = loader.handle.load_sync(path);
|
||||
vfs.set_file_contents(vfs_path.clone(), contents);
|
||||
}
|
||||
vfs.file_id(&vfs_path)
|
||||
}
|
||||
}
|
||||
let res = vfs.file_id(&vfs_path);
|
||||
if res.is_none() {
|
||||
tracing::warn!("failed to load {}", path.display())
|
||||
}
|
||||
res
|
||||
};
|
||||
|
||||
let mut crate_graph = CrateGraph::default();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue