]> git.lizzy.rs Git - rust.git/commitdiff
Add a FIXME
authorKirill Bulatov <mail4score@gmail.com>
Mon, 24 May 2021 11:52:57 +0000 (14:52 +0300)
committerKirill Bulatov <mail4score@gmail.com>
Mon, 24 May 2021 11:52:57 +0000 (14:52 +0300)
crates/project_model/src/workspace.rs

index ede82d88bd0a860e59b71038a1f5f6aedbde878f..84990075f728e4d56be8d31d9156284d56cdf0aa 100644 (file)
@@ -49,6 +49,15 @@ pub enum ProjectWorkspace {
     },
     /// Project workspace was manually specified using a `rust-project.json` file.
     Json { project: ProjectJson, sysroot: Option<Sysroot>, rustc_cfg: Vec<CfgFlag> },
+
+    // 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<AbsPathBuf>, sysroot: Sysroot, rustc_cfg: Vec<CfgFlag> },