Skip to content

Commit eafbc7b

Browse files
committed
fix: Include all target types with paths outside package root
1 parent ebf7fd1 commit eafbc7b

File tree

1 file changed

+14
-2
lines changed
  • src/tools/rust-analyzer/crates/project-model/src

1 file changed

+14
-2
lines changed

src/tools/rust-analyzer/crates/project-model/src/workspace.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -819,10 +819,16 @@ impl ProjectWorkspace {
819819
// [lib]
820820
// path = "../../src/lib.rs"
821821
// ```
822+
//
823+
// or
824+
//
825+
// ```toml
826+
// [[bin]]
827+
// path = "../bin_folder/main.rs"
828+
// ```
822829
let extra_targets = cargo[pkg]
823830
.targets
824831
.iter()
825-
.filter(|&&tgt| matches!(cargo[tgt].kind, TargetKind::Lib { .. }))
826832
.filter_map(|&tgt| cargo[tgt].root.parent())
827833
.map(|tgt| tgt.normalize().to_path_buf())
828834
.filter(|path| !path.starts_with(&pkg_root));
@@ -874,10 +880,16 @@ impl ProjectWorkspace {
874880
// [lib]
875881
// path = "../../src/lib.rs"
876882
// ```
883+
//
884+
// or
885+
//
886+
// ```toml
887+
// [[bin]]
888+
// path = "../bin_folder/main.rs"
889+
// ```
877890
let extra_targets = cargo[pkg]
878891
.targets
879892
.iter()
880-
.filter(|&&tgt| matches!(cargo[tgt].kind, TargetKind::Lib { .. }))
881893
.filter_map(|&tgt| cargo[tgt].root.parent())
882894
.map(|tgt| tgt.normalize().to_path_buf())
883895
.filter(|path| !path.starts_with(&pkg_root));

0 commit comments

Comments
 (0)