From 5c0369b1d0c5351672f2a16e9a0d17beee84bcbe Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Mon, 24 May 2021 14:52:57 +0300 Subject: Add a FIXME --- crates/project_model/src/workspace.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/project_model/src/workspace.rs b/crates/project_model/src/workspace.rs index ede82d88b..84990075f 100644 --- a/crates/project_model/src/workspace.rs +++ b/crates/project_model/src/workspace.rs @@ -49,6 +49,15 @@ pub enum ProjectWorkspace { }, /// Project workspace was manually specified using a `rust-project.json` file. Json { project: ProjectJson, sysroot: Option, rustc_cfg: Vec }, + + // FIXME: The primary limitation of this approach is that the set of detached files needs to be fixed at the beginning. + // That's not the end user experience we should strive for. + // Ideally, you should be able to just open a random detached file in existing cargo projects, and get the basic features working. + // That needs some changes on the salsa-level though. + // In particular, we should split the unified CrateGraph (which currently has maximal durability) into proper crate graph, and a set of ad hoc roots (with minimal durability). + // Then, we need to hide the graph behind the queries such that most queries look only at the proper crate graph, and fall back to ad hoc roots only if there's no results. + // After this, we should be able to tweak the logic in reload.rs to add newly opened files, which don't belong to any existing crates, to the set of the detached files. + // // /// Project with a set of disjoint files, not belonging to any particular workspace. /// Backed by basic sysroot crates for basic completion and highlighting. DetachedFiles { files: Vec, sysroot: Sysroot, rustc_cfg: Vec }, -- cgit v1.2.3