mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Register virtual workspace Cargo.toml files in the VFS
This commit is contained in:
parent
7f1f85ac16
commit
d4dc3ca83b
15 changed files with 77 additions and 37 deletions
|
@ -15,7 +15,7 @@ use ide_db::{
|
|||
};
|
||||
use itertools::Itertools;
|
||||
use proc_macro_api::{MacroDylib, ProcMacroServer};
|
||||
use project_model::{CargoConfig, PackageRoot, ProjectManifest, ProjectWorkspace};
|
||||
use project_model::{CargoConfig, ManifestPath, PackageRoot, ProjectManifest, ProjectWorkspace};
|
||||
use span::Span;
|
||||
use tracing::instrument;
|
||||
use vfs::{file_set::FileSetConfig, loader::Handle, AbsPath, AbsPathBuf, VfsPath};
|
||||
|
@ -238,6 +238,19 @@ impl ProjectFolders {
|
|||
fsc.add_file_set(file_set_roots)
|
||||
}
|
||||
|
||||
// register the workspace manifest as well, note that this currently causes duplicates for
|
||||
// non-virtual cargo workspaces! We ought to fix that
|
||||
for manifest in workspaces.iter().filter_map(|ws| ws.manifest().map(ManifestPath::as_ref)) {
|
||||
let file_set_roots: Vec<VfsPath> = vec![VfsPath::from(manifest.to_owned())];
|
||||
|
||||
let entry = vfs::loader::Entry::Files(vec![manifest.to_owned()]);
|
||||
|
||||
res.watch.push(res.load.len());
|
||||
res.load.push(entry);
|
||||
local_filesets.push(fsc.len() as u64);
|
||||
fsc.add_file_set(file_set_roots)
|
||||
}
|
||||
|
||||
let fsc = fsc.build();
|
||||
res.source_root_config = SourceRootConfig { fsc, local_filesets };
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue