mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Consider crate declaration names
This commit is contained in:
parent
32f5276465
commit
5cffef56e2
11 changed files with 135 additions and 86 deletions
|
@ -99,13 +99,19 @@ impl MockAnalysis {
|
|||
root_crate = Some(crate_graph.add_crate_root(
|
||||
file_id,
|
||||
Edition2018,
|
||||
None,
|
||||
cfg_options,
|
||||
Env::default(),
|
||||
));
|
||||
} else if path.ends_with("/lib.rs") {
|
||||
let other_crate =
|
||||
crate_graph.add_crate_root(file_id, Edition2018, cfg_options, Env::default());
|
||||
let crate_name = path.parent().unwrap().file_name().unwrap();
|
||||
let other_crate = crate_graph.add_crate_root(
|
||||
file_id,
|
||||
Edition2018,
|
||||
Some(crate_name.to_owned()),
|
||||
cfg_options,
|
||||
Env::default(),
|
||||
);
|
||||
if let Some(root_crate) = root_crate {
|
||||
crate_graph
|
||||
.add_dep(root_crate, CrateName::new(crate_name).unwrap(), other_crate)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue