diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-02-29 15:36:03 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-02-29 15:36:03 +0000 |
commit | 099a8f37f5fd41f7afe26039b063973617133153 (patch) | |
tree | 1ee876766ad8be3b7dedefbe781f856b0cca63bd /crates/ra_hir_def/src/marks.rs | |
parent | 0ae7054210b0bbc48ea51c3672be640d3096cfdd (diff) | |
parent | b9fbb3da1740ddef0ab5d9dcbb75e50b92ba0c09 (diff) |
Merge #3309
3309: Find cargo toml up the fs r=matklad a=not-much-io
Currently rust-analyzer will look for Cargo.toml in the root of the project and if failing that then go down the filesystem until root.
This unfortunately wouldn't work automatically with (what I imagine is) a fairly common project structure. As an example with multiple languages like:
```
js/
..
rust/
Cargo.toml
...
```
Added this small change so rust-analyzer would glance one level up if not found in root or down the filesystem.
## Why not go deeper?
Could be problematic with large project vendored dependencies etc.
## Why not add a Cargo.toml manual setting option?
Loosely related and a good idea, however the convenience of having this automated also is hard to pass up.
## Testing?
Build a binary with various logs and checked it in a project with such a structure:
```
[ERROR ra_project_model] find_cargo_toml()
[ERROR ra_project_model] find_cargo_toml_up_the_fs()
[ERROR ra_project_model] entities: ReadDir("/workspaces/my-project")
[ERROR ra_project_model] candidate: "/workspaces/my-project/rust/Cargo.toml", exists: true
```
## Edge Cases?
If you have multiple Cargo.toml files one level deeper AND not in the root, will get whatever comes first (order undefined), example:
```
crate1/
Cargo.toml
crate2/
Cargo.toml
... (no root Cargo.toml)
```
However this is quite unusual and wouldn't have worked before either. This is only resolvable via manually choosing.
Co-authored-by: nmio <[email protected]>
Diffstat (limited to 'crates/ra_hir_def/src/marks.rs')
0 files changed, 0 insertions, 0 deletions