Skip to content

Commit

Permalink
Merge pull request #18866 from bobozaur/fix-fetching-on-buildfile-cha…
Browse files Browse the repository at this point in the history
…nges

Fix JSON project `PackageRoot` buildfile inclusion
  • Loading branch information
Veykril authored Jan 7, 2025
2 parents 9344334 + 9fb7c15 commit 1287e29
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/tools/rust-analyzer/crates/project-model/src/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,18 +606,18 @@ impl ProjectWorkspace {
ProjectWorkspaceKind::Json(project) => project
.crates()
.map(|(_, krate)| {
let build_files = project
.crates()
.filter_map(|(_, krate)| {
krate.build.as_ref().map(|build| build.build_file.clone())
})
// FIXME: PackageRoots dont allow specifying files, only directories
.filter_map(|build_file| {
self.workspace_root().join(build_file).parent().map(ToOwned::to_owned)
});
// FIXME: PackageRoots dont allow specifying files, only directories
let build_file = krate
.build
.as_ref()
.map(|build| self.workspace_root().join(&build.build_file))
.as_deref()
.and_then(AbsPath::parent)
.map(ToOwned::to_owned);

PackageRoot {
is_local: krate.is_workspace_member,
include: krate.include.iter().cloned().chain(build_files).collect(),
include: krate.include.iter().cloned().chain(build_file).collect(),
exclude: krate.exclude.clone(),
}
})
Expand Down

0 comments on commit 1287e29

Please sign in to comment.