Commit 99b69ec
authored
bug: Use manifest path as reported buildfile (#38)
Previously, we were reporting the workspace Cargo.toml as the buildfile
for a `discover` invocation. This led to incorrect behavior where RA
would "unindex" any crates that were included in the first `discover`
invocation but not in subsequent invocations (reporting the buildfile as
the workspace Cargo.toml implies that we are telling RA about all of the
crates in the workspace, but we are actually only telling it about a
subset). Consider the following dependency graph:
```
A: C
B: C
C:
```
If we're invoked with a file from crate `A`, we would tell RA about
crates `A` and `C` with the workspace manifest as the buildfile. If we
are subsequently invoked with a file from crate `B`, we'd still report
the buildfile as the workspace manifest, but now we'd only tell RA about
crates `B` and `C`. This causes RA to "unindex" `A`, since we're telling
RA that the workspace doesn't include it.
This commit rectifies the issue by reporting the current crate's
Cargo.toml as the buildfile in the `discover` output. However, this
changes the semantics of how and when `check` is invoked. In the above
example, we'd now report two separate "projects" after being invoked
with files from crates `A` and `B`. Because `A` and `B` do not depend on
each other, RA will invoke `check` separately for each of them. This is
rather annoying if they share many dependencies (e.g. if `C` has a giant
dependency tree), since those `check` invocations will be duplicating a
lot of work.
This behavior can be adjusted by setting RA's `check.invocationStrategy`
setting to `"once"`, which tells it just to invoke check for the current
project instead of all the projects we've told it about. This commit
also updates the README to reflect this change.
Fixes #341 parent f827ba7 commit 99b69ec
2 files changed
Lines changed: 4 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| 101 | + | |
101 | 102 | | |
102 | 103 | | |
103 | 104 | | |
| |||
115 | 116 | | |
116 | 117 | | |
117 | 118 | | |
| 119 | + | |
118 | 120 | | |
119 | 121 | | |
120 | 122 | | |
| |||
149 | 151 | | |
150 | 152 | | |
151 | 153 | | |
| 154 | + | |
152 | 155 | | |
153 | 156 | | |
154 | 157 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | 220 | | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
| 221 | + | |
237 | 222 | | |
238 | 223 | | |
239 | 224 | | |
| |||
0 commit comments